Skip to content

Add support for previous year grades - #287

Merged
psvenk merged 16 commits into
masterfrom
prevyear-rest
Apr 12, 2021
Merged

psvenk merged 16 commits into
masterfrom
prevyear-rest

Conversation

@psvenk

@psvenk psvenk commented Apr 3, 2021 •

Copy link
Copy Markdown
Member

Closes #99. Thanks to the REST API, the backend implementation here is much simpler than that in #182. While fetching grades seems to work, I am marking this pull request as a draft because there are a few known bugs:

  • Assignment statistics do not work for previous-year classes
  • Switching between current year and previous year seems to cause some buggy behavior in the term dropdown:
    image
  • The schedule and reports callbacks send data to currentTableData, which may be current or previous, meaning that the other option will not have schedule/reports data; the callbacks should be updated to send their data to both tableData[0] and tableData[1].
  • Switching between years may cause the quarter displayed in the quarter/GPA dropdown to be inconsistent with the quarter whose grades are displayed. This is because, when switching years (except when switching to "previous year"), Aspine tries to look up the same quarter in the other year, which may not exist; in this case, the dropdown displays the nonexistent quarter and the table displays something else.

@psvenk psvenk added this to the 2.8.0 milestone Apr 3, 2021
@psvenk

psvenk commented Apr 10, 2021

Copy link
Copy Markdown
Member Author
  • The schedule and reports callbacks send data to currentTableData, which may be current or previous, meaning that the other option will not have schedule/reports data; the callbacks should be updated to send their data to both tableData[0] and tableData[1].

Fixed in 157bc2d.

@psvenk

psvenk commented Apr 10, 2021

Copy link
Copy Markdown
Member Author
  • Assignment statistics do not work for previous-year classes

Fixed in cb14a44.

psvenk added 8 commits April 10, 2021 21:41
Thanks to the REST API, this is painless and just means threading a
variable and otherwise changing 2 lines of code.
Classes from the previous year are listed under every term for some
reason, making it necessary to parse the "term" field.
This can be expanded to a trichotomy of type=current, type=previous
(previous year), and type=imported
Consistently treat "term" properties as being of type TermSpec
Add "Previous Year" to the dropdown and tableData and change some code
to adapt accordingly; however, this does not yet populate
currentTableData.
Additionally, the default quarter for "Previous Year" is now Q1, and the
"current quarter" (which is arbitrarily set to Q1) is now disabled.
The schedule and reports callbacks send their payloads to
currentTableData, which could be the current year or the previous year;
make sure to copy these data from one to the other so that they are
accessible in both.
psvenk added 2 commits April 10, 2021 22:02
Because the current quarter is marked as inaccessible for the previous
year, the cumulative GPA entry of the quarter dropdown cannot be treated
the same way as the current quarter (this was a somewhat hacky solution
to begin with); separate the cumulative GPA handling from the current
quarter handling.
Unconditionally updating the overview in responseCallbackPartial has the
side effect of breaking the JSON import functionality because
responseCallbackPartial is called without an overview object.
@psvenk

psvenk commented Apr 11, 2021

Copy link
Copy Markdown
Member Author
  • Switching between current year and previous year seems to cause some buggy behavior in the term dropdown

Fixed in 55fa433.

psvenk added 4 commits April 10, 2021 22:48
Rename vestigial and possibly confusing variable name `_this`, and make
sure that the callback always runs
Doing a simple comparison of innerHTML does not necessarily work due to
the presence of tooltips; instead, it is necessary to retrieve the first
child node of the element, which includes just the top-level text node
(and excludes any tooltips).
Instead of attempting to select the same term in another year, which is
not always possible (that term may not be available in the other year),
always move to the first available term.
Remove the repetition of quarter dropdown setup from the tableData
dropdown callback.
@psvenk

psvenk commented Apr 11, 2021 •

Copy link
Copy Markdown
Member Author
  • Switching between years may cause the quarter displayed in the quarter/GPA dropdown to be inconsistent with the quarter whose grades are displayed. This is because, when switching years (except when switching to "previous year"), Aspine tries to look up the same quarter in the other year, which may not exist; in this case, the dropdown displays the nonexistent quarter and the table displays something else.

Fixed in 6e8037a.

@psvenk
psvenk marked this pull request as ready for review April 11, 2021 03:18
@psvenk

psvenk commented Apr 11, 2021 •

Copy link
Copy Markdown
Member Author

This should be ready for review. As with #220 (albeit to a lesser extent), these are fairly major changes, so it would be good to have reviews from multiple people before this is merged.

@jadebuckwalter jadebuckwalter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me!

@MohanMaker MohanMaker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall looks good to me, thanks for this great feature @psvenk!

One bug I discovered is that you can not switch the GPA type when the previous year is selected.

Also, the concept of cumulative GPA is a bit confusing when you are in the previous year since it still shows your cumulative GPA up to the current date. Maybe it could tell you your average GPA for that year, as well as the overall cumulative GPA?

Also, I wish it would show previous year's schedule and attendance reports, but that can come later...

@psvenk

psvenk commented Apr 11, 2021

Copy link
Copy Markdown
Member Author

@jadebuckwalter @MohanMaker Thank you for your speedy reviews.

It seems that the GPA code is looking for a property in the previous year data that is not present, causing these two bugs; it should (hopefully) be a simple fix. More generally, this reminds me of @tektaxi's comment that the concept of "cumulative GPA" is more generally confusing in the previous year: if it works properly, it shows the average GPA for that year; however, the wording seems to suggest that it shows the cumulative GPA for the past two years, or for all four years, as is being tracked in #116. Maybe we can call it "yearlong GPA" or something similar?

With respect to the previous year's schedule and attendance reports, I don't think Aspen exposes this information. Maybe we should move the year dropdown so that it is clear that this only affects the "Grades" tab, but this is probably part of #187.

psvenk added 2 commits April 12, 2021 15:03
Even though there is no "current" term in the previous year, the GPA
object is expected to exist in all terms.
Make the code more succinct and readable, and make sure to populate the
cumulative GPA as well.
@psvenk

psvenk commented Apr 12, 2021

Copy link
Copy Markdown
Member Author

@MohanMaker Both of the bugs that you noticed should now be fixed (the GPA type bug in 65d9a45 and the cumulative GPA bug in 3a168db); could you check if this is the case on your end when you have some time?

@psvenk
psvenk requested a review from MohanMaker April 12, 2021 19:19

@MohanMaker MohanMaker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just tested and everything is working correctly! I will also make a comment on the other issues you mentioned above so we can remember to discuss the dropdown and the wording of cumulative GPA.

@tektaxi tektaxi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Works well for me. I don't see any remaining bugs. We should definitely clarify the cumulative GPA thing though, right now it is still confusing.

@psvenk
psvenk merged commit ba1c6dd into master Apr 12, 2021
@psvenk
psvenk deleted the prevyear-rest branch April 12, 2021 22:32
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.

Get grades from previous year

4 participants