22from rdflib import Graph
33
44from scaffold import startup
5- from scaffold .utils .utils import get_performance_month
65
76preferences_dict = {}
87history_dict = {}
@@ -28,7 +27,11 @@ def from_req(req_info):
2827 except Exception :
2928 pass
3029
31- performance_month = get_performance_month (req_info , performance_df ["month" ].max ())
30+ performance_month = startup .performance_month
31+ if req_info ["performance_month" ]:
32+ performance_month = req_info ["performance_month" ]
33+ if not performance_month :
34+ performance_month = performance_df ["month" ].max ()
3235
3336 staff_number = int (performance_df .at [0 , "staff_number" ])
3437
@@ -48,7 +51,7 @@ def from_req(req_info):
4851 subject_graph += startup .base_graph
4952
5053
51- def from_global (staff_num , perf_month ):
54+ def from_global (staff_num ):
5255 global \
5356 preferences_dict , \
5457 history_dict , \
@@ -58,28 +61,32 @@ def from_global(staff_num, perf_month):
5861 subject_graph
5962
6063 staff_number = int (staff_num )
61- history_dict = {}
64+
65+ try :
66+ performance_df = startup .performance_data [
67+ startup .performance_data ["staff_number" ] == staff_number
68+ ].reset_index (drop = True )
69+ except Exception :
70+ pass
71+
72+ performance_month = startup .performance_month
73+ if not performance_month :
74+ performance_month = performance_df ["month" ].max ()
75+
6276 preferences_dict = {}
63- performance_month = perf_month
6477 try :
6578 p = startup .preferences .loc [staff_number , "preferences" ]
6679 preferences_dict = set_preferences (p )
6780 except Exception :
6881 return set_preferences ({})
6982
83+ history_dict = {}
7084 try :
7185 staff_data = startup .history [startup .history ["staff_number" ] == staff_number ]
7286 history_dict = staff_data .set_index ("month" )["history" ].to_dict ()
7387 except Exception :
7488 pass
7589
76- try :
77- performance_df = startup .performance_data [
78- startup .performance_data ["staff_number" ] == staff_number
79- ].reset_index (drop = True )
80- except Exception :
81- pass
82-
8390 subject_graph = Graph ()
8491 subject_graph += startup .base_graph
8592
0 commit comments