Skip to content

Update minor fix 2#809

Merged
tenkus47 merged 2 commits into
developfrom
update_minor_fix_2
Jun 25, 2026
Merged

Update minor fix 2#809
tenkus47 merged 2 commits into
developfrom
update_minor_fix_2

Conversation

@tenkus47

Copy link
Copy Markdown
Member

No description provided.

tenkus47 and others added 2 commits June 25, 2026 12:59
Introduce get_series_plan_schedule_by_series_ids for lightweight plan fields and item counts, and update series service to use it.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tenkus47 tenkus47 requested a review from Tech-lo June 25, 2026 07:34
@sonarqubecloud

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Jun 25, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

Safe to merge; the behavioural changes are intentional, well-tested, and confined to schedule calculation and group language fallback logic.

All production call sites of _series_schedule_from_plans pass published_only=True, which causes the function to call _get_sorted_active_plans twice with identical arguments. The second call's guard branch is unreachable on the common path, creating a minor dead-code smell but no incorrect behaviour. The SeriesPlanScheduleRow.deleted_at field is always None due to the DB filter, making the downstream check a no-op — harmless but slightly misleading. No data correctness or security issues were found.

pecha_api/plans/series/series_service.py (redundant double call) and pecha_api/plans/series/series_repository.py (deleted_at field semantics) are worth a second look, though neither blocks merging.

Reviews (1): Last reviewed commit: "Update series plan scheduling functional..." | Re-trigger Greptile

Comment on lines +187 to +195
schedule_plans = _get_sorted_active_plans(
plans,
published_only=True,
language=language,
fallback=fallback,
)
series_total_days = sum(_plan_total_days(plan) for plan in sorted_plans)
first_plan = sorted_plans[0]
if not first_plan.start_date:
if not schedule_plans:
return None, None, series_total_days

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unreachable branch when published_only=True

Both production call sites pass published_only=True, so sorted_plans and schedule_plans are computed by identical _get_sorted_active_plans invocations. If sorted_plans is non-empty (the guard at line 184 already passed), schedule_plans will also be non-empty, making the if not schedule_plans return at line 194 dead code on that path. For the published_only=False path the two calls intentionally diverge (total_days from all plans, dates from published only), but for the common published_only=True path you pay the cost of a second filter+sort for no effect. You could short-circuit with schedule_plans = sorted_plans if published_only else _get_sorted_active_plans(plans, published_only=True, language=language, fallback=fallback) to make the intent explicit and avoid the duplicate work.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@tenkus47 tenkus47 merged commit e129153 into develop Jun 25, 2026
7 checks passed
@tenkus47 tenkus47 deleted the update_minor_fix_2 branch June 25, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants