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
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@
"EMAIL_USER": "_unused_",
"EMAIL_PASSWORD": "_unused_",
"IGNORE_CONFIG_FILE": "true",
"TRACKS": []
"TRACKS": [],
<<<<<<< HEAD
"THRESHOLD_ABSENT": 1=4
=======
"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?

>>>>>>> 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!

},
"keywords": [
"gavel",
Expand Down
4 changes: 3 additions & 1 deletion config.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,6 @@ send_stats: null
# defaults to empty list(no tracks)
#
# this setting defines any sub-categories('tracks') that contestants can compete in
tracks: null
tracks: null

threshold_absent: 4
1 change: 1 addition & 0 deletions config.vagrant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ email_from: '' # needs to be set to something even though email is disabled
email_user: ''
email_password: ''
send_stats: false # disabled for development
threshold_absent: 4
Binary file added gavel/.DS_Store
Binary file not shown.
Binary file added gavel/controllers/.DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions gavel/controllers/judge.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def tx():
elif request.form['action'] == 'Absent':
annotator.next.absent.append(annotator)
annotator.ignore.append(annotator.next)
if len(annotator.next.absent) >= settings.THRESHOLD_ABSENT:
annotator.next.active = False
else:
# ignore things that were deactivated in the middle of judging
if annotator.prev.active and annotator.next.active:
Expand Down Expand Up @@ -121,6 +123,8 @@ def tx():
annotator.next = None # will be reset in index
elif request.form['action'] == 'Absent' :
annotator.next.absent.append(annotator)
if len(annotator.next.absent) >= settings.THRESHOLD_ABSENT:
annotator.next.active = False
annotator.next = None
db.session.commit()
with_retries(tx)
Expand Down
1 change: 1 addition & 0 deletions gavel/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ def _list(item):
USE_SENDGRID = _bool(c.get('use_sendgrid', 'USE_SENDGRID', default=False))
SENDGRID_API_KEY = c.get('sendgrid_api_key','SENDGRID_API_KEY', default=None)
TRACKS = c.get('tracks', 'TRACKS', default=[])
THRESHOLD_ABSENT = c.get('threshold_absent','THRESHOLD_ABSENT')
3 changes: 2 additions & 1 deletion gavel/templates/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <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">Skipped</th>
{% for track in tracks %}
<th data-sort-method="caseInsensitiveSort">{{track | safe}}</th>
Expand All @@ -52,6 +52,7 @@ <h2>Projects</h2>
<td>{{ item.sigma_sq | round(4) }}</td>
<td>{{ item_counts.get(item.id, 0) }}</td>
<td>{{ item.viewed | length }}</td>
<td>{{ item.absent | length }}</td>
htoo97 marked this conversation as resolved.
Show resolved Hide resolved
<td>{{ skipped.get(item.id, 0) }}</td>
{% for track in tracks %}
{% if item.__dict__[track] == true %}
Expand Down