Files
doormile_backend/controllers
Suriya 9b3ec886ce fix: populate riderkms and ridercharges on delivery completion
riderkms, ridercharges and bonuspoints appeared in exactly three places in the
codebase — all three GET /miler/earnings reading them. Nothing ever wrote them,
so every completed job reported zero distance and zero value and the earnings
screen was permanently empty.

On delivery completion:
- riderkms is the distance ridden for the booking, pickup point to where the
  rider confirmed delivery, falling back to the booking's delivery coordinates
  when the app sends no position.
- ridercharges is the order amount the tenant is billed, supplied at creation
  as finalprice and already stored on the booking service option. Doormile does
  not compute it; this is pass-through.
- bonuspoints deliberately left at zero pending a decision on what earns them.

Also moves the monthly earnings window onto utils.DBNow, so it doesn't put a
rider in the wrong month for 5h30m either side of a month boundary.

Note historical rows keep whatever completedat they were written with before
the image gained TZ=Asia/Kolkata, so figures spanning today are mixed; not
backfilled.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 18:33:01 +05:30
..