Skip to content

Commit

Permalink
pass site with get_consent_datetime_or_raise
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Apr 10, 2024
1 parent 3b610ba commit 019a21a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion edc_crf/crf_form_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from edc_appointment.form_validator_mixins import WindowPeriodFormValidatorMixin
from edc_form_validators import INVALID_ERROR, FormValidator
from edc_registration import get_registered_subject_model_cls
from edc_sites.form_validator_mixin import SiteFormValidatorMixin
from edc_utils import floor_secs, formatted_datetime, to_utc
from edc_utils.date import to_local
from edc_visit_tracking.modelform_mixins import get_related_visit
Expand All @@ -26,6 +27,7 @@ class CrfFormValidatorError(Exception):
class CrfFormValidator(
WindowPeriodFormValidatorMixin,
CrfFormValidatorMixin,
SiteFormValidatorMixin,
FormValidator,
):
"""Form validator for CRfs.
Expand Down Expand Up @@ -64,7 +66,7 @@ def validate_crf_report_datetime(self) -> None:
# not before consent date
report_datetime = to_utc(self.report_datetime)
consent_datetime = self.get_consent_datetime_or_raise(
report_datetime=report_datetime, fldname="report_datetime"
report_datetime=report_datetime, site=self.site, fldname="report_datetime"
)
if floor_secs(report_datetime) < floor_secs(consent_datetime):
msg = _("Invalid. Cannot be before date of consent. Participant consented on")
Expand Down

0 comments on commit 019a21a

Please sign in to comment.