diff --git a/project/npda/general_functions/quarter_for_date.py b/project/npda/general_functions/quarter_for_date.py index 6ed21040..7324f404 100644 --- a/project/npda/general_functions/quarter_for_date.py +++ b/project/npda/general_functions/quarter_for_date.py @@ -3,7 +3,7 @@ def retrieve_quarter_for_date(date_instance: date) -> int: """ - Returns the quarter number of the patient for a given submission date (today) + Returns which quarter the date instance lies in A quarter simply is defined as the quarter of the audit year the submission date lies in @@ -13,6 +13,13 @@ def retrieve_quarter_for_date(date_instance: date) -> int: quarter 3: 1st October - 31st December quarter 4: 1st January - 31st March """ + if date_instance is None: + return None + if not isinstance(date_instance, date): + raise ValueError("date_instance must be of type date") + if date_instance > date.today(): + return None + # Audit start date is on the 1st April every year audit_start_date = date(date_instance.year, 4, 1) if date_instance < audit_start_date: diff --git a/project/npda/templates/partials/patient_table.html b/project/npda/templates/partials/patient_table.html index f7550ec1..dd62a7d2 100644 --- a/project/npda/templates/partials/patient_table.html +++ b/project/npda/templates/partials/patient_table.html @@ -71,7 +71,7 @@ hx-target="#patient_table" hx-swap="innerHTML swap:100ms" class="swap-on"> - + NPDA Patient ID @@ -96,7 +96,7 @@ hx-target="#patient_table" hx-swap="innerHTML swap:100ms" class="swap-on"> - + NHS Number @@ -114,12 +114,41 @@