Repository navigation
Add support for previous year grades - #287
Conversation
Fixed in 157bc2d. |
Fixed in cb14a44. |
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.
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.
Fixed in 55fa433. |
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.
Fixed in 6e8037a. |
|
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
left a comment
There was a problem hiding this comment.
Looks good to me!
MohanMaker
left a comment
There was a problem hiding this comment.
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...
|
@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. |
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.
|
@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? |
MohanMaker
left a comment
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
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:
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 bothtableData[0]andtableData[1].