Skip to content

Commit

Permalink
Automatically deactivate team if their absent count exceeds threshold (
Browse files Browse the repository at this point in the history
…#16)

* Absent count

* corrected some bugs

* removed unnecessary comments

* fixing bugs

* Move absent deactivation outside of retry function

* more bugs

* yaml gets prioritized

* updated the threshold from 1 to 4

* removed absent header cell

* added the threshold absent count

* Removed some unnecessary lines

* updated threshold

* Delete redundant absent length

Co-authored-by: Thant Htoo Zaw <[email protected]>
  • Loading branch information
htoo97 authored Mar 4, 2020
1 parent 0192426 commit a2769e2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"EMAIL_USER": "_unused_",
"EMAIL_PASSWORD": "_unused_",
"IGNORE_CONFIG_FILE": "true",
"TRACKS": []
"TRACKS": [],
"THRESHOLD_ABSENT": 4
},
"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
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')
2 changes: 1 addition & 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>
<th data-sort-method="number" data-sort-order="desc">Absent</th>
{% for track in tracks %}
Expand Down

0 comments on commit a2769e2

Please sign in to comment.