@@ -130,10 +130,7 @@ def build_chart(schedule, spaced, color_map):
130130 """Build Plotly bar chart from schedule DataFrame."""
131131 schedule_plot = schedule .copy ()
132132 schedule_plot ["date" ] = schedule_plot ["date" ].apply (str )
133- # strip exam prefix for display in chart legend
134- schedule_plot ["display_subject" ] = schedule_plot ["subject" ].apply (
135- lambda s : s .split (": " , 1 )[- 1 ] if ": " in s else s
136- )
133+
137134 return px .bar (
138135 schedule_plot ,
139136 x = "date" ,
@@ -169,29 +166,6 @@ def build_weekly_view(schedule, spaced, week_offset=0, color_map=None, exam_colo
169166 week_start = week_start + timedelta (weeks = week_offset )
170167 week_end = week_start + timedelta (days = 6 )
171168
172- # build legend
173- legend_items = []
174- for exam_name , color in exam_colors .items ():
175- legend_items .append (
176- html .Span ([
177- html .Span (style = {
178- "display" : "inline-block" ,
179- "width" : "12px" ,
180- "height" : "12px" ,
181- "borderRadius" : "3px" ,
182- "backgroundColor" : color ,
183- "marginRight" : "4px" ,
184- "verticalAlign" : "middle"
185- }),
186- html .Span (exam_name , style = {
187- "fontSize" : "12px" ,
188- "marginRight" : "16px" ,
189- "color" : "var(--color-text-secondary)"
190- })
191- ])
192- )
193- legend = html .Div (legend_items , style = {"marginBottom" : "12px" })
194-
195169 # build week days
196170 day_cols = []
197171 for i in range (7 ):
@@ -257,7 +231,7 @@ def build_weekly_view(schedule, spaced, week_offset=0, color_map=None, exam_colo
257231 "overflow" : "hidden"
258232 })
259233
260- return html .Div ([nav , legend , calendar ])
234+ return html .Div ([nav ,calendar ])
261235
262236
263237def build_tips (schedule , exam_dates , start , default_hours ):
@@ -423,6 +397,10 @@ def load_exams(n_clicks):
423397 df ["date" ] = pd .to_datetime (df ["date" ]).dt .date
424398
425399 for _ , row in df .iterrows ():
400+ # skip if this exam name is already loaded
401+ if any (e ["name" ] == row ["name" ] for e in exams ):
402+ continue
403+
426404 topic_list = []
427405 if pd .notna (row ["topics" ]) and row ["topics" ]:
428406 for t in row ["topics" ].split ("," ):
0 commit comments