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

Update site updates when exercises change and add wip guard #2009

Merged
merged 4 commits into from
Oct 6, 2021

Conversation

iHiD
Copy link
Member

@iHiD iHiD commented Oct 1, 2021

This moves the guarding and updating into one command.

We currently have a race condition where this happens:

  • Exercise created
  • Site updated created
  • Authors added

This change means that every time the exercise syncs, the site update is refreshed, not just when it's created.


Closes #2009

@iHiD iHiD requested a review from ErikSchierboom October 1, 2021 15:26
@@ -0,0 +1,40 @@
require "test_helper"

class ConceptExercise::CreateTest < ActiveSupport::TestCase
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
class ConceptExercise::CreateTest < ActiveSupport::TestCase
class SiteUpdates::ProcessNewExerciseUpdateTest < ActiveSupport::TestCase

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks. I reckon loads of flakey tests happen because of this bug.

refute SiteUpdate.exists?
end

test "creates if not wip" do
Copy link
Member

Choose a reason for hiding this comment

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

We could consider adding explicit tests for beta and active.

initialize_with :exercise

def call
if exercise.wip?
Copy link
Member

Choose a reason for hiding this comment

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

What happens in the unlikely case that a new exercise is created with the deprecated status?

@iHiD
Copy link
Member Author

iHiD commented Oct 5, 2021

@ErikSchierboom Thanks. Better?

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

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

Nice!

@iHiD iHiD merged commit 0c92497 into main Oct 6, 2021
@iHiD iHiD deleted the fix-site-updates branch October 6, 2021 11:48
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