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

preserve submission timestamp when updating assessment lock state #24786

Merged
merged 3 commits into from Sep 14, 2018

Conversation

davidsbailey
Copy link
Member

@davidsbailey davidsbailey commented Sep 13, 2018

In response to https://codeorg.zendesk.com/agent/tickets/208820 . Ideally we'd add a submitted_at column to UserLevel instead of relying on updated_at, but that table is huuuge and this fix is straight forward.

The code change in this PR affects the codepath for updating the lock state. For additional context, this data gets to the assessments tab in the client via this call stack:

submitted: locked || readonly_answers,
readonly_answers: !locked && readonly_answers,
unlocked_at: locked ? nil : Time.now,
# level_group, which is the only levels that we lock, always sets best_result to 100 when complete
best_result: (locked || readonly_answers) ? ActivityConstants::BEST_PASS_RESULT : user_level.best_result
)

# preserve updated_at, which represents the user's submission timestamp.
user_level.save!(touch: false)
Copy link
Member Author

Choose a reason for hiding this comment

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

@aoby , could I please have a sanity check from a rails perspective that assign_attributes + save! is equivalent to update!? That substitution is intended to be a pure refactor (no behavior change), and the touch: false param is supposed to be the part that implements the behavior change.

@davidsbailey davidsbailey merged commit f303650 into staging Sep 14, 2018
@davidsbailey davidsbailey deleted the preserve-submission-timestamp branch September 14, 2018 20:31
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.

None yet

3 participants