-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add ending time to challenges #506
base: master
Are you sure you want to change the base?
Add ending time to challenges #506
Conversation
Does this work with PentestFlags? Also does this stop the calculation for ShareChallenges when the challenge closes? ( ctf-scoreboard/app/lib/flag_challenge_share_module.rb Lines 84 to 95 in f6066a1
|
It should stop calculation now based on challenge.close_challenge_at (if it exists) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this stop the calculation for ShareChallenges when the challenge closes?
It should stop calculation now based on challenge.close_challenge_at (if it exists)
I don't see any committed changes modifying the flag_challenge_share_module
or ShareChallenge
model.
You should be able to test whether the challenge close time exists by creating a copy of the following test:
ctf-scoreboard/test/models/pentest_flag_test.rb
Lines 41 to 57 in 2cc2b70
test 'point value stops increasing and decreasing after game completion' do | |
@game.update(start: 3.hours.ago, stop: 2.hours.ago) | |
unsolve_team = create(:team) | |
point_value = @challenge.defense_flags.sample.display_point_value(unsolve_team) | |
assert_equal 102, point_value | |
end | |
test 'point value stops increasing and decreasing after game completion for solved challenge' do | |
@game.update(start: 3.hours.ago, stop: 2.hours.ago) | |
solve_team = create(:team) | |
unsolve_team = create(:team) | |
solved_challenge = create(:pentest_solved_challenge, team: solve_team, challenge: @challenge, created_at: 3.hours.ago) | |
# Points decrease at ~3 points per hour with the challenge defined above | |
# This game only lasts 1 hour and therefore unsolve_team is shown they would've received | |
# 47 points if they solved this challenge right at the end of the game. | |
assert_equal 47, solved_challenge.flag.display_point_value(unsolve_team) | |
end |
Change the game to close at the current time instead of 2 hours ago, and change the challenge to close 2 hours ago. The score should then be exactly the same even though the game was open an additional 2 hours (since the challenge was closed).
Putting this as a draft until I can figure out what's making it return the wrong value for flags |
This pull request has conflict. Could you fix it @camdenmoors? |
1 similar comment
This pull request has conflict. Could you fix it @camdenmoors? |
This closes #487
challenge_end
column to challengesbefore_close?
to the challenge model to check if it's before closing timechallenge.open?
to callbefore_close?