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

Automatically deactivate team if their absent count exceeds threshold #16

Merged
merged 17 commits into from
Mar 4, 2020

Conversation

ayushiatsharma
Copy link

@ayushiatsharma ayushiatsharma commented Feb 26, 2020

Solved: issue #10

New feature:
An absent button for the judges to use when a team is not present during the judging process. If the number of times a team is marked “absent” by the judges crosses a specified threshold then the team would be deactivated.

Tested the feature by:
-Adding a new sample project and a judge from admin view
-Marking the sample project “absent” from the judge client view
-Going back and making sure that the absent count was increased by 1 and the team was actually deactivated (Note: for testing purposes, if a team was marked as absent ONCE then it would be deactivated)

Screenshot from the admin view when the new project named "Testing Absent Count" is added:
ADDING A PROJECT

The judge client view of the project:
JUDGE VIEW

Team, "Testing Absent Count", deactivated after a judge marked it "absent"
TEAM_DEACTIVATED

Copy link

@htoo97 htoo97 left a comment

Choose a reason for hiding this comment

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

Added some comments by the files. Also, as I mentioned to you before, please add:

  • Type of change: {Bug fix, New feature, Breaking change, Documentation update}
  • How the code change was tested: {Plain text description of testing steps would be fine}

The testing is especially important for this change, since it will automatically deactivate the team. Please post the screenshots of your testing as well, like the admin page before judge presses absent, the judge client view of pressing absent on that team, and then the reloaded admin page after judge presses absent that shows the team as deactivated.

app.json Outdated
@@ -23,6 +23,7 @@
"EMAIL_PASSWORD": "_unused_",
"IGNORE_CONFIG_FILE": "true",
"TRACKS": []
"THRESHOLD_ABSENT": 2
Copy link

Choose a reason for hiding this comment

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

I know you were using 2 as a tester, but can you change this default to 4?

target_state = action == 'Disable'
def tx():
Item.by_id(item_id).active = False
db.session.commit() #to here
Copy link

Choose a reason for hiding this comment

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

Please get rid of the #to here fluff comment. Same thing with #from here on line 89.

@@ -86,6 +86,13 @@ def tx():
elif request.form['action'] == 'Absent':
annotator.next.absent.append(annotator)
annotator.ignore.append(annotator.next)
if count >= settings.THRESHOLD_ABSENT: #from here
Copy link

Choose a reason for hiding this comment

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

Did you test this out? count doesn't seem to be defined anywhere, and it should give you an error the moment you run this. You should be looking at the length of the absent list: len(annotator.next.absent).

@@ -86,6 +86,13 @@ def tx():
elif request.form['action'] == 'Absent':
annotator.next.absent.append(annotator)
annotator.ignore.append(annotator.next)
if count >= settings.THRESHOLD_ABSENT: #from here
item_id = request.form['item_id']
target_state = action == 'Disable'
Copy link

Choose a reason for hiding this comment

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

What are these 2 lines here for?

Copy link

@htoo97 htoo97 left a comment

Choose a reason for hiding this comment

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

Lgtm! Will merge after you get to the testing

@@ -31,7 +31,8 @@ <h2>Projects</h2>
<th class="sort-default" data-sort-method="number" data-sort-order="desc">Mu</th>
<th data-sort-method="number">Sigma Squared</th>
<th data-sort-method="number">Votes</th>
<th data-sort-method="number">Seen</th>
<th data-sort-method="number">Seen</th>
<th data-sort-method="number" data-sort-order="desc">Absent</th>
Copy link

Choose a reason for hiding this comment

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

Can you remove the changes from this file? The changes here are important enough that I'm going to commit directly to master. Thanks!

@ayushiatsharma ayushiatsharma changed the title Deactivating the team Automatically deactivate team if their absent count exceeds threshold Mar 4, 2020
app.json Outdated
"THRESHOLD_ABSENT": 1=4
=======
"THRESHOLD_ABSENT": 2
>>>>>>> 193c8c15a75bd580d301c9d875600de2ed0f5891
Copy link

Choose a reason for hiding this comment

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

Merge conflict markers!

gavel/templates/admin.html Outdated Show resolved Hide resolved
@htoo97 htoo97 merged commit a2769e2 into master Mar 4, 2020
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