Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fangeugene/fb0c39747c0890706fc9fa92a3e99328 to your computer and use it in GitHub Desktop.
Save fangeugene/fb0c39747c0890706fc9fa92a3e99328 to your computer and use it in GitHub Desktop.
Count Touchpad Positions
from models.match import Match
matches = Match.query(Match.year==2017).fetch()
near_count = 0
middle_count = 0
far_count = 0
for match in matches:
for color in ['red', 'blue']:
if not match.score_breakdown:
continue
if match.score_breakdown[color]['touchpadNear'] == 'ReadyForTakeoff':
near_count += 1
if match.score_breakdown[color]['touchpadMiddle'] == 'ReadyForTakeoff':
middle_count += 1
if match.score_breakdown[color]['touchpadFar'] == 'ReadyForTakeoff':
far_count += 1
print near_count, middle_count, far_count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment