Skip to content

Fix courserun_is_current logic and select * in mitxonline_course_engagements_daily_report#1924

Merged
quazi-h merged 2 commits into
mitxonline-course-engagements-daily-reportfrom
copilot/sub-pr-1906
Feb 20, 2026
Merged

Fix courserun_is_current logic and select * in mitxonline_course_engagements_daily_report#1924
quazi-h merged 2 commits into
mitxonline-course-engagements-daily-reportfrom
copilot/sub-pr-1906

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 20, 2026

Two correctness/hygiene issues in the mitxonline_course_engagements_daily_report model.

Changes

  • mitx_courses CTE: Replace select * with explicit column selection (mitxonline_course_id, course_readable_id) to reduce scan cost and decouple from upstream schema changes.

  • courserun_is_current: Align computation with int__combined__course_runs — use from_iso8601_timestamp() instead of cast(substring(..., 1, 10) as date), and use an exclusive end boundary (> current_date) rather than inclusive (>= current_date). This avoids off-by-one behavior for runs ending at midnight and keeps "current" semantics consistent across the project.

-- Before
case
    when cast(substring(courserun_start_on, 1, 10) as date) <= current_date
        and (courserun_end_on is null
            or cast(substring(courserun_end_on, 1, 10) as date) >= current_date)
        then true
    else false
end as courserun_is_current

-- After (matches int__combined__course_runs pattern)
case
    when courserun_end_on is null
        and from_iso8601_timestamp(courserun_start_on) <= current_date
        then true
    when from_iso8601_timestamp(courserun_start_on) <= current_date
        and from_iso8601_timestamp(courserun_end_on) > current_date
        then true
    else false
end as courserun_is_current

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…s_daily_report

Co-authored-by: quazi-h <59845076+quazi-h@users.noreply.github.com>
Copilot AI changed the title [WIP] Add model for mitxonline course engagements daily report Fix courserun_is_current logic and select * in mitxonline_course_engagements_daily_report Feb 20, 2026
Copilot AI requested a review from quazi-h February 20, 2026 20:39
@quazi-h quazi-h marked this pull request as ready for review February 20, 2026 21:15
@quazi-h quazi-h merged commit ecfb7d0 into mitxonline-course-engagements-daily-report Feb 20, 2026
2 checks passed
@quazi-h quazi-h deleted the copilot/sub-pr-1906 branch February 20, 2026 21:15
quazi-h added a commit that referenced this pull request Feb 27, 2026
…engagements_daily_report (#1924)

* Initial plan
* Fix courserun_is_current and select * in mitxonline_course_engagements_daily_report
Co-authored-by: quazi-h <59845076+quazi-h@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: quazi-h <59845076+quazi-h@users.noreply.github.com>
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