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

Lms/updated parallel write responses #9393

Merged
merged 10 commits into from
Jul 25, 2022

Conversation

anathomical
Copy link
Contributor

WHAT

Begin writing ConceptResult records whenever we write OldConceptResult records so that both tables keep up to date with any new data from student activities

WHY

We eventually want to replace OldConceptResult with ConceptResult, so we need to make sure we can write to both at the same time. Once we're doing that, we can confirm that the data being written is complete in both places to build confidence for a full switch-over

HOW

Add a worker that writes ConceptResult records, and enqueue that job during the ActivitySessionController's handle_concept_results function which is the place where that data gets written.

Notion Card Links

https://www.notion.so/quill/Write-Response-records-in-parallel-with-ConceptResults-977206a533da442c9c3cd9fa9ad97be7

PR Checklist Your Answer
Have you added and/or updated tests? Yes
Have you deployed to Staging? Deploying now
Self-Review: Have you done an initial self-review of the code below on Github? Yes
Spec Review: Have you reviewed the spec and ensured this meets requirements and/or matches design mockups? N/A

Comment on lines -84 to +90
activity_session.reload
expect(activity_session.old_concept_results.size).to eq 7
# Run Sidekiq jobs immediately instead of queuing them
Sidekiq::Testing.inline! do
expect do
put :update, params: { id: activity_session.uid, concept_results: concept_results }, as: :json
end.to change { activity_session.reload.old_concept_results.size }.by(3)
.and change { activity_session.reload.concept_results.size }.by(3)
end
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 original version of those code with expect ... to eq 7 was counting the items that were created as part of setup as well as the ones created by the function call. This cleans things up slightly to only count items new from the call.

@anathomical anathomical marked this pull request as ready for review July 21, 2022 19:47
Copy link
Member

@brendanshean brendanshean left a comment

Choose a reason for hiding this comment

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

A couple of minor comments/questions but nothing holding up approval. Nice sleuthing on the bulk_insert bug.

Copy link
Member

@dandrabik dandrabik left a comment

Choose a reason for hiding this comment

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

One note about naming, but looks good to me.

services/QuillLMS/app/models/old_concept_result.rb Outdated Show resolved Hide resolved
Don't give it the same name as the original gem's name so that we can avoid confusion
@anathomical anathomical merged commit 12b8c97 into develop Jul 25, 2022
@delete-merged-branch delete-merged-branch bot deleted the lms/updated-parallel-write-responses branch July 25, 2022 14:23
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.

4 participants