Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grading Overview: TS/Tremor -> AG/Blueprint Migration #2893

Open
wants to merge 76 commits into
base: master
Choose a base branch
from

Conversation

InfinityTwo
Copy link
Contributor

@InfinityTwo InfinityTwo commented Mar 30, 2024

Description

This is a major update to the Grading Overview page which migrates from Tanstack Table and Tremor UI to AG Grid and Blueprint JS. It also introduces a few new features that change the user workflow.

Summary

Note

For future Avengers and Developers, we would like you to feedback and think about these aspects for future development

  • XP sorting. Currently sorted by raw XP, but is it preferred over combined XP?
  • Grading/Filter mode. Is it better to default to Grading or Filter mode? Do you have any default preferences? (Devs can consider session storage for this, and column filters)
  • Is it better to sort Type by ordering of the tabs at the top (e.g Missions, Quests, Paths, Contests...) or alphabetically?
  • Is it helpful to add a column for submission date/time?

Please give your feedback in the latest Avenger feedback form/issue tracker or feel free to submit a new issue tracker. Thank you!

Features/Changes Added

Feature/Change 1 - Migration of Table

Part of #2525 and #2849. Adds onto #2856.

All components under Grading Overview will have their components migrated from Tanstack Table and Tremor UI to AG Grid and Blueprint JS. This also means some existing features are modified and may not work the same as before. I have tried my best to keep the table looking the same as before, less the changes made as new features. In #2856, Publish and Unpublish grading buttons were added. I've changed it to become icons to better suit the table. The Unpublish icon can be seen in the picture below, with the first row with the grading icon. The publish icon is at the second row of icons, the last icon.

Screenshot_1

Feature/Change 2 - Grading/Filter Mode

The default workflow is grading mode. Click on the Grading Mode/Filter Mode button beside the search bar.

In Grading mode, the entire row of each submission (except actions) will be clickable, which navigates the user straight to the submission grading page. This was added as the expected workflow for new users (avengers) was to be able to enter the grading of that submission when clicked, instead of filtering it. The Grading action icon will be removed to declutter the table in this mode.

In Filter Mode, it works the same as the previous table. When you click on any cell that allows filtering, it will filter by the value of that cell throughout the table. The Grading action button will be added back here to avoid the friction of going back to Grading Mode.

Besides the button to differentiate Grading/Filter Mode, when you hover over filterable cells, in Grading Mode, individual cells will not be highlighted/underlined when hovered but in Filter Mode, it will do so.

Filter Mode
Screenshot_3

Grading Mode
Screenshot_2

Feature/Change 3 - Customer Column Headers - Sorting & Hideable Columns

Somewhat part of #2665.

On the top of each column header, there are two buttons on the right. The first button allows you to sort in ascending/descending order. The workflow is don't sort by default, click to sort by ascending, click again to sort by descending, and click again to not sort it.

Note that the sorting is done on the backend with this PR #1107

The second button allows you to hide the respective columns. This allows you to view the table with less clutter, and it helps with devices that have a smaller screen.

Custom Headers with filtered columns and cell
Screenshot_4

Other Minor Changes

  • (a) Loading Table Overlay

When filtering or searching for new queries, the table will not load in the new data if another query has been made. On the shell, it still queries for the data in the backend and receives every new query like the previous table as this is a purely frontend change.

I have also added a loading animation to show that it's retrieving the requested data. It shows the animation on the first query and hides it when the most recent data from the most recent query has been received.

The table will also become uninteractable (filtering will still be interactable) when querying for the data.

Tl;dr of how it works: when a query is sent, the counter increments by 1. When a query is received, the counter decrements by 1 or stays at 0 if already at 0. If the counter !== 0, then the loading is shown. In certain rare cases, it may not show the loading overlay (still can't figure out why).

a

E

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code quality improvements

How to test

Head over to the Grading page and explore it over there.

Checklist

  • I have migrated the core components & features
  • I have cleaned up unrequired files and code
  • I have modified mock data
  • I have extensively tested this code
  • I have successfully merged it with the latest master branch (including P2's isGradingPublished PR) and fixed all conflicts
  • Backend Sorting has been completed
  • I have updated the documentation (Not sure if needed)

@InfinityTwo InfinityTwo self-assigned this Mar 30, 2024
Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

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

Hi, looking forward for the changes! For now, I have some preliminary comments below:


Thanks for working on this!

Copy link
Member

Choose a reason for hiding this comment

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

In the resolution of merge conflicts, I went to prioritise your changes over the recently merged PRs, thus the current version does not support team assessments (in fact, some of the other files give a compile error).

Can you help take a look? I've attached the fields that were modified by team assessment PR as a code comment.

The basic idea is that now there will be an XOR constraint (either studentName will be populated in case of an individual assessment, or studentNames for team assessment – same for studentUsername and studentUsernames). Thus the table display will fallback to joining the studentNames/studentUsernames field if the other one is empty.

Refer to #2548 for more details.

Please contact me via Telegram if you require any clarifications.

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for merging up with most of the conflicts, I'll let you know if I need help with this one!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've merged the changes for this in the latest commit, but I'm unsure if the data shown is correct. I have messaged you on this.

@@ -0,0 +1,56 @@
declare const twJustifyContentValues: readonly ["justify-start", "justify-end", "justify-center", "justify-between", "justify-around", "justify-evenly"];
Copy link
Member

Choose a reason for hiding this comment

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

Can I check what is this used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

think I copied it blindly to avoid errors, will look through as well with the other next comment when I get around to looking at it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed in the latest commit, it can be resolved once you are ok with it.

Comment on lines 19 to 34
display: "flex",
justifyContent:
(justifyContent === "justify-start"
? "flex-start"
: justifyContent === "justify-end"
? "flex-end"
: justifyContent === "justify-center"
? "center"
: justifyContent === "justify-between"
? "space-between"
: justifyContent === "justify-around"
? "space-around"
: justifyContent === "justify-evenly"
? "space-evenly"
: ""
),
Copy link
Member

Choose a reason for hiding this comment

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

Seems like we are mapping Tailwind values to actual styles – what's the need for this? Can we just map input props directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just being lazy and trying to avoid touching existing props but I can go through all of it again when I work on it to remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed in the latest commit, it can be resolved once you are ok with it.

);
}

export default GradingFlex;
Copy link
Member

Choose a reason for hiding this comment

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

Please add an empty line at the end of this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed in the latest commit, it can be resolved once you are ok with it.

);
}

export default GradingText;
Copy link
Member

Choose a reason for hiding this comment

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

Ditto on newline at EOF

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been fixed in the latest commit, it can be resolved once you are ok with it.

@@ -466,6 +484,7 @@ function* BackendSaga(): SagaIterator {
gradedFilter,
pageParams,
filterParams
// sortedBy
Copy link
Member

Choose a reason for hiding this comment

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

Is this going to be used/removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will be used for backend column sorting onced implemented, commented for now in case it causes errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has been uncommented in the latest commit and the various issues that comes with it has been fixed.

@josh1248
Copy link
Contributor

josh1248 commented Apr 3, 2024

does this change have the edge case bugs in #2812? seems likely that aggrid's way of doing things over tanstack could help to curb the forceful frontend filtering and solve the issue.

@InfinityTwo
Copy link
Contributor Author

InfinityTwo commented Apr 3, 2024

does this change have the edge case bugs in #2812? seems likely that aggrid's way of doing things over tanstack could help to curb the forceful frontend filtering and solve the issue.

It does indeed have that case as the way data is handled is not under aggrid, but I will provide a (rough frontend) fix it in the next commit.

Edit: The changes have been made, and the second issue in the PR will currently remove the filters for Attempting/Attempted (basically those that aren't Submitted) when selecting ungraded in what to view.

@coveralls
Copy link

coveralls commented Apr 6, 2024

Pull Request Test Coverage Report for Build 9361057403

Details

  • 30 of 212 (14.15%) changed or added relevant lines in 17 files are covered.
  • 9 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.2%) to 31.192%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/commons/grading/GradingText.tsx 2 3 66.67%
src/pages/academy/grading/subcomponents/GradingFilterable.tsx 1 2 50.0%
src/pages/academy/teamFormation/subcomponents/TeamFormationBadges.tsx 0 1 0.0%
src/commons/grading/GradingFlex.tsx 2 4 50.0%
src/commons/workspace/WorkspaceActions.ts 5 7 71.43%
src/pages/academy/grading/subcomponents/GradingColumnFilters.tsx 1 3 33.33%
src/commons/workspace/WorkspaceReducer.ts 0 4 0.0%
src/pages/academy/grading/subcomponents/GradingActions.tsx 1 5 20.0%
src/commons/sagas/RequestsSaga.ts 0 5 0.0%
src/commons/sagas/BackendSaga.ts 0 8 0.0%
Files with Coverage Reduction New Missed Lines %
src/pages/academy/grading/subcomponents/GradingActions.tsx 1 2.33%
src/pages/academy/grading/Grading.tsx 4 0.0%
src/pages/academy/grading/subcomponents/GradingSubmissionsTable.tsx 4 2.6%
Totals Coverage Status
Change from base Build 9101202777: -0.2%
Covered Lines: 4924
Relevant Lines: 14811

💛 - Coveralls

* Add React import
* Remove unnecessary type annotations
* Extract default styles outside component
* Remove unused props
* Add React import
* Use `classnames` utility
* Use `Classes` object instead of raw string CSS API
* Move constant default styles out of component
* Remove unused props
* Use strict inequality
* Use `Object.entries` to iterate over both key and value
* Add React import
* Use `useSession` over `useTypedSelector`
* Use Blueprint's `Tooltip` component over `htmlTitle`
* Remove unnecessary `={true}` in props
* Simplify conditionals with `&&`
For better readability.
For readability.
* Add React import
* Use `classNames` utility instead of `String`
* Remove unused prop export
* Convert Props interface to type
* Remove unnecessary type annotations and arguments
* Convert conditional to `&&`
* Add React import
* Improve typing of badge colors
* Use optional chaining where possible
* Remove unused export
Also renamed a type to `Props` as it is unexported.
@RichDom2185 RichDom2185 requested a review from chownces May 12, 2024 08:38
Copy link
Collaborator

@lhw-1 lhw-1 left a comment

Choose a reason for hiding this comment

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

First of all, I appreciate the extensive documentation on the PR itself. Great job! 😄

In terms of the migration & features, I like that the UI was kept consistent despite the migration - thanks for the effort! One additional suggestion here might be to include a tooltip for how Filter Mode vs Grading Mode works, but it's not urgent & can be a separate issue.

Overall, the changes seem reasonable & I don't think I have too many issues with the implementation itself. I have a few small queries / nits on the changes below:

src/commons/grading/GradingFlex.tsx Show resolved Hide resolved
src/commons/grading/GradingText.tsx Show resolved Hide resolved
};

Object.keys(allColsSortStates.currentState).forEach(key => {
if (allColsSortStates.sortBy === key && key != '') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (allColsSortStates.sortBy === key && key != '') {
if (allColsSortStates.sortBy === key && key !== '') {

By convention & keeping it consistent with BackendSaga.ts

Copy link
Collaborator

Choose a reason for hiding this comment

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

Adding on - would there be any issues if we just do key instead of key !== ''?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed it to key since it works too 😄

export enum SortStates {
ASC = 'sort-asc',
DESC = 'sort-desc',
NONE = 'sort'
Copy link
Collaborator

Choose a reason for hiding this comment

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

The enum seems to be used now instead of the raw string values 👍

@@ -53,6 +74,20 @@ export type GradingOverviewWithNotifications = {
*/
export type GradingAnswer = GradingQuestion[];

export type AllColsSortStates = {
currentState: SortStateProperties;
sortBy: ColumnFieldsKeys | '';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the | '' necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The empty string allows us to not sort by any columns, which is the default state from my memory

studentUsername = 'Username(s)',
groupName = 'Group',
progressStatus = 'Progress',
xp = 'Raw XP (+Bonus)',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
xp = 'Raw XP (+Bonus)',
xp = 'Raw XP (+ Bonus)',

Just a very tiny unimportant personal preference, feel free to reject based on whichever looks better in the UI 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the one without space looks better in the UI after trying it out, having a space feels a little off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
5 participants