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: update chat visibility #1297

Merged
merged 1 commit into from
Feb 22, 2024
Merged

Conversation

alangsto
Copy link
Contributor

The backend for the learning assistant will not return 200 responses for courses that don't pass certain date conditions. We should replicate that behavior on the frontend to ensure that users do not see 400 errors.

Copy link

codecov bot commented Feb 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8335dec) 88.36% compared to head (265f1a0) 88.37%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1297      +/-   ##
==========================================
+ Coverage   88.36%   88.37%   +0.01%     
==========================================
  Files         291      291              
  Lines        4941     4948       +7     
  Branches     1245     1251       +6     
==========================================
+ Hits         4366     4373       +7     
  Misses        561      561              
  Partials       14       14              

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

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. I have two comments about where you're computing whether the date is valid and testing that function. I approved this because I'm open to not addressing my comments, but let me know what you think is best.

@@ -70,6 +70,23 @@ const Course = ({

const SidebarProviderComponent = enableNewSidebar === 'true' ? NewSidebarProvider : SidebarProvider;

const chatValidDates = () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since course comes from the Redux store, I think we could read in the course with the useModel hook and compute this data within the Chat component to avoid having Chat specific logic in the Course component. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, technically, this bit of code is untested. If you move this into Chat, you'll have to add this data to the mock Redux store for it to work properly in your test. That would get you better test coverage, but would be more work.

If you want to get this out and fast-follow with the refactor/testing changes, I'm good with that. But let me know if you don't think this is 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.

I think I'd like to get this out and then work on updating the tests/refactor afterwards. Once I merge this I'll start that work.

@@ -182,7 +181,7 @@ describe('Chat', () => {
enabled
courseId={courseId}
contentToolsEnabled={false}
endDate={new Date(currentTime.getTime() - 10 * 60000).toISOString()}
validDates={false}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I'd rename this test, because it's testing something less specific now.

@alangsto alangsto merged commit 6def666 into master Feb 22, 2024
7 checks passed
@alangsto alangsto deleted the alangsto/update_la_visibility branch February 22, 2024 16:46
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