-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Hotfix/jm 7928 (#761) * Updated made on call a required field. (#755) * Confirm attendance list is taking into account confirmed but returned trial attendances. This should only show the unconfirmed count. (#753) * Added restrictions to confirm attendance so prevent attendances from being confirmed multiple times. * Fixed tests * History stating jury attendance confirmed when return but do not confirm was selected (#752) * Fixed issue where jury attendance history would get created if you returned the panel but did not confirm attendance * Fixed tests * Added additional scheduler metrics (#575) * Added additional scheduler metrics * Added additional scheduler metrics * Added null or blank check when checking if an email / phone number exists * Minor tidy up * Fixed compile issue * Added validating in for invalid phone numbers or email addresses * Applied review comments * hotfix/JM-8102 fix for missing days (#756) * hotfix/JM-8102 fix for missing days * updated flyway migration name to avoid conflict * hotfix/JM-7928 update to utilisation report query --------- Co-authored-by: Ben Edwards <147524406+Ben-Edwards-cgi@users.noreply.github.com> * Hotfix/jm 8102 (#760) * hotfix/JM-8102 fix for missing days * updated flyway migration name to avoid conflict * Revert "Hotfix/jm 7928 (#761)" This reverts commit 2c0c871. * interim1 release candidate changes only * Update DailyUtilisationReportsITest_typical.sql * Update DailyUtilisationReportsITest_typical.sql --------- Co-authored-by: Ben Edwards <147524406+Ben-Edwards-cgi@users.noreply.github.com>
- Loading branch information
1 parent
a44626f
commit b91610b
Showing
3 changed files
with
98 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/resources/db/migrationv2/V2_30__util_report_update.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
-- utility function to return list of all days within the report window and holiday flag | ||
-- updated to correctly handle no trial days added by a court and multiple holidays on the same day | ||
CREATE OR REPLACE FUNCTION juror_mod.util_report_report_days_list(p_loc_code text, p_start_date date, p_end_date date) | ||
RETURNS TABLE(report_date date, holiday boolean) | ||
LANGUAGE plpgsql | ||
AS $function$ | ||
begin | ||
|
||
return query | ||
|
||
with report_days as ( | ||
select generate_series(p_start_date, p_end_date, '1 day'::interval)::date as report_day) | ||
|
||
select distinct(report_days.report_day) as report_date, | ||
case when h.holiday is not null then true else false end as holiday | ||
from report_days | ||
left join juror_mod.holiday h on (report_days.report_day = h.holiday and (h.loc_code is null or h.loc_code = p_loc_code)) | ||
order by report_days.report_day; | ||
|
||
END; | ||
$function$ | ||
; |
38 changes: 38 additions & 0 deletions
38
src/main/resources/db/migrationv2/V2_31__util_report_update.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
|
||
-- This function is used to generate a list of jurors who are in a pool during a given date range. | ||
-- Updated the query to only count genuine appearances rather than non-attendance or no-shows. | ||
CREATE OR REPLACE FUNCTION juror_mod.util_report_pool_members_list(p_loc_code text, p_start_date date, p_end_date date) | ||
RETURNS TABLE(juror_number character varying, attendance_date date, return_date date, service_start_date date, service_end_date date, min_status integer) | ||
LANGUAGE plpgsql | ||
AS $function$ | ||
begin | ||
|
||
return query select | ||
jp.juror_number, | ||
min(a.attendance_date) attendance_date, | ||
min(case when jp.is_active = true then p.return_date else to_date('01/12/2099', 'dd/mm/yyyy') end ) return_date, | ||
greatest(least(coalesce(min(a.attendance_date), min(case when jp.is_active = true then p.return_date else to_date('01/12/2099', 'dd/mm/yyyy') end )), | ||
min(case when jp.is_active = true then p.return_date else to_date('01/12/2099','dd/mm/yyyy') end )), p_start_date) service_start, | ||
-- figure out if an appearance occurred before service start date and use that if applicable | ||
least(min(coalesce(case when jp.status = 10 then jp.transfer_date else date(j.completion_date) end, p_end_date)),p_end_date) service_end, | ||
min(status) min_status | ||
from juror_mod.juror_pool jp | ||
join juror_mod.juror j | ||
on jp.juror_number = j.juror_number | ||
join juror_mod.pool p | ||
on jp.pool_number = p.pool_no | ||
left join juror_mod.appearance a | ||
on jp.juror_number = a.juror_number | ||
where p.loc_code = a.loc_code | ||
and (((jp.status in (2,3,4,10,13) or (jp.status = 7 and a.attendance_date is not null)) and jp.is_active = true) | ||
or (jp.status = 8 and a.attendance_date is not null and j.completion_date is not null)) | ||
and (a.non_attendance is null or a.non_attendance = false) and (a.no_show is null or a.no_show = false) | ||
and p.loc_code = p_loc_code | ||
and ((jp.status = 10 and jp.transfer_date >= p_start_date) | ||
or (jp.status <> 10 and (j.completion_date is null or j.completion_date >= p_start_date))) | ||
group by jp.juror_number | ||
having (least(coalesce(min(a.attendance_date), min(case when jp.is_active = true then p.return_date else to_date('01/12/2099', 'dd/mm/yyyy') end)), | ||
min(case when jp.is_active = true then p.return_date else to_date('01/12/2099', 'dd/mm/yyyy') end)) <= p_end_date); | ||
END; | ||
$function$ | ||
; |