Skip to content

Commit 669daa3

Browse files
fixed style mistakes, removed unnecessary legend code and fixed load_exam in app.py
1 parent 1bbb1b3 commit 669daa3

4 files changed

Lines changed: 9 additions & 32 deletions

File tree

src/my_studysmart.xlsx

17 Bytes
Binary file not shown.

src/study_smart/app.py

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -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

263237
def 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(","):

src/study_smart/schedule.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ def _schedule_reviews(topic_name, first_study_day, exam_date,
3636
for interval in review_intervals:
3737
review_date = first_study_day + timedelta(days=interval)
3838

39-
#skip if review date is on or after exam date
39+
# skip if review date is on or after exam date
4040
if review_date >= exam_date:
4141
continue
42-
#check remaining hours on review date
42+
# check remaining hours on review date
4343
available = _available_hours_per_day(review_date, commitments=commitments)
4444
remaining = available - allocated.get(review_date, 0.0)
4545

46-
#no room - skip this review
46+
# no room - skip this review
4747
if remaining <= 0:
4848
continue
4949

tests/test_schedule.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Tests cover:
55
- _available_hours_per_day: commitment deduction and minimum floor
66
- _round_to_half: rounding behaviour
7-
- _distribute_hours: proportional distribution and edge cases
87
- build_schedule: single and multiple exams, topics, commitments, overload handling
98
- build_schedule with spaced repetition: review intervals, skipping, topic defaults
109
- generate_tips: active recall, deep understanding, and light load tips

0 commit comments

Comments
 (0)