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

feat: gate visibility of chat component by active attempt #1282

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

alangsto
Copy link
Contributor

@alangsto alangsto commented Feb 5, 2024

COSMO-86

The chat component should not be visible if a learner has an active attempt. The special exams library has been refactored so that the exam state is accessible outside of components defined in the exams library. This PR makes use of the newly available exams reducer to gave chat visibility.

Copy link
Contributor

@MichaelRoytman MichaelRoytman left a comment

Choose a reason for hiding this comment

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

This looks good to me so far. Looking forward to testing this out once the feature branch is merged!

const shouldDisplayChat = (
enabled
&& (hasVerifiedEnrollment || isStaff) // display only to verified learners or staff
&& !endDatePassed()
&& !hasActiveAttemptId
Copy link
Contributor

@MichaelRoytman MichaelRoytman Feb 5, 2024

Choose a reason for hiding this comment

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

Nit: I think you can just use !activeAttemptId, right? That'll cast activeAttemptId to a boolean and then negate it. hasActiveAttemptId is unnecessary, because you're negating the value activeAttemptId twice.

@alangsto alangsto force-pushed the alangsto/gate_chat_visibility_by_exam branch 4 times, most recently from 69e3208 to be646af Compare February 8, 2024 20:41
@alangsto alangsto marked this pull request as ready for review February 8, 2024 20:42
@alangsto alangsto force-pushed the alangsto/gate_chat_visibility_by_exam branch from be646af to 50b4ecf Compare February 8, 2024 20:49
Copy link

codecov bot commented Feb 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a18ed8e) 88.33% compared to head (50b4ecf) 88.33%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1282   +/-   ##
=======================================
  Coverage   88.33%   88.33%           
=======================================
  Files         291      291           
  Lines        4929     4931    +2     
  Branches     1242     1243    +1     
=======================================
+ Hits         4354     4356    +2     
  Misses        561      561           
  Partials       14       14           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alangsto alangsto merged commit db1fc77 into master Feb 12, 2024
7 checks passed
@alangsto alangsto deleted the alangsto/gate_chat_visibility_by_exam branch February 12, 2024 14:17
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.

2 participants