Skip to content

Refactor Times to only encompass a single session of a course#1713

Draft
Purplegaze wants to merge 2 commits into
Courseography:masterfrom
Purplegaze:y-session-fix
Draft

Refactor Times to only encompass a single session of a course#1713
Purplegaze wants to merge 2 commits into
Courseography:masterfrom
Purplegaze:y-session-fix

Conversation

@Purplegaze
Copy link
Copy Markdown
Contributor

Proposed Changes

Initial refactor and migration script to change Times objects in the database to only encompass a single session of a course. second_room (currently unused due to a bug) is removed, first_room is renamed to location, and a new session field is added to disambiguate the F and S sessions of a year-long course. A fall-winter Meeting will now have two Times objects linked to it, one for each session.

This moves the database in line with the direct timetable API response, which splits the fall and winter timeslots of a year-long course into different objects, and is a precursor to fixing the bug where year-long (Fall-Winter Y session) courses don't appear in the database.

...

Screenshots of your changes (if applicable)

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change) X
New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue)
🎨 User interface change (change to user interface; provide screenshots)
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.
  • I have updated the project Changelog (this is required for all changes).

After opening your pull request:

  • I have verified that the CircleCI checks have passed.
  • I have requested a review from a project maintainer.

Questions and Comments

(See separate comment)

@Purplegaze
Copy link
Copy Markdown
Contributor Author

I'm unsure what the scope of this PR should be, and what I should add into a separate PR.
So far I've added the migration script and changed Times itself, and resolved any immediate errors in Tables.hs (i.e. Times to Time and Time' conversions) by temporarily slotting in null data. But there are other places in the code that expect Times to behave a certain way which I need to rewire (e.g. tests still pass, but the location doesn't show up at the moment). Time and Time' will also need to be changed to match, and in turn, everything that relies on them. What extent should I bring this PR to, and what should be separate?

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 0

Coverage decreased (-0.06%) to 57.326%

Details

  • Coverage decreased (-0.06%) from the base build.
  • Patch coverage: 4 uncovered changes across 1 file (7 of 11 lines covered, 63.64%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
app/Database/Migrations.hs 7 3 42.86%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
app/Database/Tables.hs 1 31.48%

Coverage Stats

Coverage Status
Relevant Lines: 3950
Covered Lines: 2316
Line Coverage: 58.63%
Relevant Branches: 964
Covered Branches: 501
Branch Coverage: 51.97%
Branches in Coverage %: Yes
Coverage Strength: 163.35 hits per line

💛 - Coveralls

Copy link
Copy Markdown
Contributor

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

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

Hi @Purplegaze, you're definitely in the right direction here. For this task it'll be divided into multiple steps, so I've created a new branch on origin called y-course-refactor. As a first step, please re-make this PR, but using the target branch of Courseography:y-course-refactor instead of Courseography:master. You will continue to make other PRs onto that branch until we're done, at which point we'll make one file PR to merge y-course-refactor into master.

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.

3 participants