Server backup 2026-11-07 of uncommitted work in projects/pharma-web-celtic

Snapshot of the working tree on srv1071960 (branch main), taken during
server cleanup. .env files, node_modules, builds, logs and media were excluded.
This commit is contained in:
Shubhankar45
2026-11-07 05:43:12 +00:00
parent b001e2d03c
commit 0d30c58bf0
98 changed files with 1878 additions and 573 deletions
+21 -2
View File
@@ -7,6 +7,7 @@ from app.reports.schemas import (
DCRRead,
DoctorCallRead,
PlannedVisitRead,
StockistCallRead,
)
@@ -15,8 +16,12 @@ def planned_visits(dcr: DailyCallReport) -> list[PlannedVisitRead]:
plan = dcr.plan
if plan is None:
return []
visited = {c.doctor_id for c in dcr.doctor_calls} | {c.chemist_id for c in dcr.chemist_calls}
missed = {m.doctor_id or m.chemist_id: m for m in dcr.missed_visits}
visited = (
{c.doctor_id for c in dcr.doctor_calls}
| {c.chemist_id for c in dcr.chemist_calls}
| {c.stockist_id for c in dcr.stockist_calls}
)
missed = {m.doctor_id or m.chemist_id or m.stockist_id: m for m in dcr.missed_visits}
def line(kind, target_id, name, is_core, planned_time) -> PlannedVisitRead:
note = missed.get(target_id)
@@ -38,6 +43,9 @@ def planned_visits(dcr: DailyCallReport) -> list[PlannedVisitRead]:
] + [
line("CHEMIST", c.chemist_id, c.chemist.name, False, c.visit_time)
for c in plan.chemist_calls
] + [
line("STOCKIST", c.stockist_id, c.stockist.name, False, c.visit_time)
for c in plan.stockist_calls
]
return sorted(lines, key=lambda x: x.planned_time)
@@ -91,6 +99,17 @@ def to_read(dcr: DailyCallReport) -> DCRRead:
)
for c in sorted(dcr.chemist_calls, key=lambda x: x.visit_time)
],
stockist_calls=[
StockistCallRead(
id=c.id,
stockist_id=c.stockist_id,
stockist_name=c.stockist.name,
visit_time=c.visit_time,
pob=c.pob,
remarks=c.remarks,
)
for c in sorted(dcr.stockist_calls, key=lambda x: x.visit_time)
],
planned_visits=planned_visits(dcr),
)