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

Assessment Configurability in Ground Control #2863

Merged
merged 39 commits into from
Mar 26, 2024

Conversation

jayjay19630
Copy link
Contributor

@jayjay19630 jayjay19630 commented Mar 22, 2024

Description

This pull request aims to allow users to configure on an assessment basis. This will allow finer control of each individual assessment's features, such as token counters and voting features.

Screenshot 2024-03-22 at 4 30 02 PM

Additionally, the admin panel will have general assessment configuration toggles for token counters and voting features. However, toggles such as Token Counter and Voting Features will only activate these features upon the creation of an assessment. Any further changes involving token counters and voting features must be done within ground control.

Screenshot 2024-03-22 at 4 30 17 PM

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have tested this code

@coveralls
Copy link

coveralls commented Mar 22, 2024

Pull Request Test Coverage Report for Build 8438080400

Details

  • 4 of 34 (11.76%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 35.234%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/features/groundControl/GroundControlActions.ts 1 2 50.0%
src/pages/academy/adminPanel/subcomponents/assessmentConfigPanel/AssessmentConfigPanel.tsx 0 5 0.0%
src/commons/sagas/BackendSaga.ts 1 10 10.0%
src/pages/academy/groundControl/subcomponents/GroundControlConfigureCell.tsx 0 15 0.0%
Totals Coverage Status
Change from base Build 8438000716: -0.05%
Covered Lines: 5096
Relevant Lines: 13497

💛 - Coveralls

@DesSnowy
Copy link

Corresponding backend PR: source-academy/backend#1093

@martin-henz martin-henz requested a review from joeng03 March 24, 2024 10:16
@RichDom2185
Copy link
Member

@joeng03 @martin-henz if you get to reviewing this before I do, please don't immediately merge it upon approval as I expect this to be a 3-way merge conflict with 2 other PRs.

Copy link

@joeng03 joeng03 left a comment

Choose a reason for hiding this comment

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

LGTM

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, thanks for working on this, looking good! I just have some minor comments below.

As discussed, the order of merging will be:

Comment on lines 41 to 52
const toggleHasTokenCounter = useCallback(
() => setHasTokenCounter(!hasTokenCounter),
[hasTokenCounter]
);
const toggleVotingFeatures = useCallback(
() => setHasVotingFeatures(!hasVotingFeatures),
[hasVotingFeatures]
);
const toggleIsTeamAssessment = useCallback(
() => setIsTeamAssessment(!isTeamAssessment),
[isTeamAssessment]
);
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Here, we memoize, but we recreate every time isXXXX changes; this is not very ideal.

When toggling booleans, if we use the callback notation for setXXX, we can simply create the function once and not have to recreate it again:

Suggested change
const toggleHasTokenCounter = useCallback(
() => setHasTokenCounter(!hasTokenCounter),
[hasTokenCounter]
);
const toggleVotingFeatures = useCallback(
() => setHasVotingFeatures(!hasVotingFeatures),
[hasVotingFeatures]
);
const toggleIsTeamAssessment = useCallback(
() => setIsTeamAssessment(!isTeamAssessment),
[isTeamAssessment]
);
const toggleHasTokenCounter = useCallback(
() => setHasTokenCounter(prev => !prev),
[]
);
const toggleVotingFeatures = useCallback(
() => setHasVotingFeatures(prev => !prev),
[]
);
const toggleIsTeamAssessment = useCallback(
() => setIsTeamAssessment(prev => !prev),
[]
);

<p>
<b>General Configurations</b>
</p>
<Divider></Divider>
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
<Divider></Divider>
<Divider />

Copy link
Member

Choose a reason for hiding this comment

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

Ditto for the other occurrences in this file.

onChange={toggleHasTokenCounter}
inline
label="Enable token counter"
></Switch>
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
></Switch>
/>

</DialogBody>
<DialogFooter
actions={
<>
Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary fragment.

@jayjay19630
Copy link
Contributor Author

I've polished up the code to fix the above comments. Pls let me know if there are any further issues!

@RichDom2185 RichDom2185 added the blocked Something else needs pass review first label Mar 26, 2024
@RichDom2185
Copy link
Member

Will just wait for backend PR to pass review now before merging both at the same time.

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.

LGTM, thanks a lot!

@RichDom2185 RichDom2185 merged commit 9a026eb into source-academy:master Mar 26, 2024
6 checks passed
izruff pushed a commit that referenced this pull request Apr 2, 2024
* Change hasTokenCounter to hasVotingAttributes in Assessment Config. Enable tokencounter depending on assessment hasTokenCounter, not assessmentConfig

* Rename hasVotingAttributes to hasVotingFeatures

* Create dialog box for configuration in ground control

* Create dialog box for configurations with voting config toggles

* Combine toggleHasTokenCounter and toggleVotingFeatures into configureAssessment

* Create backend request for updating configurations

* Add message for updating assessment configurations

* Isolate hastokencounter as its own field

* Add non-functional voting controls

* Fix tests

* Add new column for token counter in admin panel

* Fix bugs relating to tokencounter switch

* Remove unnecessary maxwidth property on tokencounter switch

* Fix bug where toggling tokencounter would request voting features to be true to backend

* Create footer text to clarify usage of hastokencounter and hasVotingFeatures

* Align text on configure dialogbox

* Fix tests post-merge

The stronger type checking had been causing compile errors.

* Fix imports

* Add close dialog upon saving

* Uncapitalise letters in config dialog

* Change label from has token counter to enable token counter

* Code quality improvements

* Create new section for team-related configurations

* Fix code quality per suggestion

* Fix errors post-merge

* Fix lint errors

---------

Co-authored-by: Richard Dominick <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Something else needs pass review first
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants