@@ -47,7 +47,6 @@ def __init__(self, filters, color_intensity):
47
47
"work_id" ,
48
48
"event_id" ,
49
49
"work_issues" ,
50
- "phase_name" ,
51
50
"date_updated" ,
52
51
"project_name" ,
53
52
"proponent" ,
@@ -64,7 +63,7 @@ def __init__(self, filters, color_intensity):
64
63
"ministry" ,
65
64
"referral_date" ,
66
65
"actual_date" ,
67
- "eac_decision_by " ,
66
+ "anticipated_date_label " ,
68
67
"decision_by" ,
69
68
"next_pecp_date" ,
70
69
"next_pecp_title" ,
@@ -123,6 +122,8 @@ def _fetch_data(self, report_date):
123
122
exclude_phase_names = self .filters ["exclude" ]
124
123
formatted_phase_name = self ._get_formatted_phase_name ()
125
124
formatted_work_type = self ._get_formatted_work_type_name ()
125
+ formatted_anticipated_date = self ._get_formatted_date_label (formatted_work_type , formatted_phase_name )
126
+ anticipated_date_column = self ._get_anticipated_date_column (formatted_anticipated_date )
126
127
ea_type_column = self ._get_ea_type_column (formatted_phase_name )
127
128
responsible_minister_column = self ._get_responsible_minister_column (staff_minister )
128
129
@@ -292,7 +293,7 @@ def _fetch_data(self, report_date):
292
293
else_ = Project .name
293
294
).label ("amendment_title" ),
294
295
ea_type_column ,
295
- formatted_phase_name .label ("phase_name " ),
296
+ anticipated_date_column .label ("anticipated_date_label " ),
296
297
latest_status_updates .c .posted_date .label ("date_updated" ),
297
298
Project .name .label ("project_name" ),
298
299
func .coalesce (
@@ -320,14 +321,6 @@ def _fetch_data(self, report_date):
320
321
Event .anticipated_date + func .cast (func .concat (Event .number_of_days , " DAYS" ), INTERVAL )
321
322
).label ("referral_date" ),
322
323
Event .actual_date .label ("actual_date" ),
323
- case (
324
- (
325
- EventConfiguration .event_type_id == EventTypeEnum .MINISTER_DECISION .value ,
326
- func .concat (Staff .first_name , " " , Staff .last_name )
327
- ),
328
- else_ = "" ,
329
- ).label ("eac_decision_by" ),
330
- staff_decision_by .first_name .label ("eac_decision_by" ),
331
324
case (
332
325
(
333
326
EventConfiguration .event_type_id != EventTypeEnum .MINISTER_DECISION .value ,
@@ -475,6 +468,41 @@ def _get_ea_type_column(self, formatted_phase_name):
475
468
else_ = WorkType .name ,
476
469
).label ("ea_type" )
477
470
471
+ def _get_formatted_date_label (self , formatted_work_type , formatted_phase_name ):
472
+ """Returns an expression for the date label"""
473
+ return case (
474
+ (
475
+ EventConfiguration .event_type_id == EventTypeEnum .REFERRAL .value ,
476
+ case (
477
+ (
478
+ PhaseCode .name == "Effects Assessment & Recommendation" ,
479
+ "EA Certificate Package" ,
480
+ ),
481
+ else_ = formatted_phase_name ,
482
+ )
483
+ ),
484
+ else_ = case (
485
+ (
486
+ EventConfiguration .event_type_id == EventTypeEnum .MINISTER_DECISION .value ,
487
+ "EA Certificate"
488
+ ),
489
+ else_ = formatted_work_type ,
490
+ )
491
+ )
492
+
493
+ def _get_anticipated_date_column (self , formatted_anticipated_date ):
494
+ """Returns an expression for the anticipated date"""
495
+ referral_postfix = " Referral Date"
496
+ decision_postfix = " Decision Date"
497
+ date_prefix = "Anticipated "
498
+ return case (
499
+ (
500
+ EventConfiguration .event_type_id == EventTypeEnum .REFERRAL .value ,
501
+ func .concat (date_prefix , formatted_anticipated_date , referral_postfix )
502
+ ),
503
+ else_ = func .concat (date_prefix , formatted_anticipated_date , decision_postfix ),
504
+ ).label ("anticipated_date_label" )
505
+
478
506
def _get_formatted_phase_name (self ):
479
507
"""Returns an expression for the reformatted PhaseCode.name"""
480
508
return case (
0 commit comments