From 92a105a5b74eaaa92e080bc05d358c8432489c5f Mon Sep 17 00:00:00 2001 From: Pawan Verma Date: Wed, 11 Oct 2023 11:18:16 +0530 Subject: [PATCH] Fix check count on the actual visit_date instead of today --- commcare_connect/form_receiver/processor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commcare_connect/form_receiver/processor.py b/commcare_connect/form_receiver/processor.py index ea3be69d..2382c5da 100644 --- a/commcare_connect/form_receiver/processor.py +++ b/commcare_connect/form_receiver/processor.py @@ -139,7 +139,7 @@ def process_deliver_form(user, xform: XForm, app: CommCareApp, opportunity: Oppo def process_deliver_unit(user, xform: XForm, app: CommCareApp, opportunity: Opportunity, deliver_unit_block: dict): deliver_unit = get_or_create_deliver_unit(app, deliver_unit_block) counts = UserVisit.objects.filter(opportunity=opportunity, user=user).aggregate( - daily=Count("pk", filter=Q(visit_date__date=datetime.date.today())), total=Sum("pk", default=0) + daily=Count("pk", filter=Q(visit_date__date=xform.metadata.timeStart)), total=Sum("pk", default=0) ) claim = OpportunityClaim.objects.filter( opportunity_access__opportunity=opportunity, opportunity_access__user=user