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

min/max score from db (Issue #2) #7

Open
wants to merge 3 commits into
base: judge-score
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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: 4 additions & 3 deletions frontend/basic_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,11 @@ def scoring_form():

# get scoring categories for each of the prizes
cur.execute(f'''
SELECT category_name FROM HasCriteria
WHERE prize_name="{prize}"
SELECT HasCriteria.category_name, min_score, max_score FROM HasCriteria
JOIN ScoringCategory ON HasCriteria.category_name = ScoringCategory.category_name
AND prize_name="{prize}"
''')
prize_categories.append([c['category_name'] for c in cur.fetchall()])
prize_categories.append(cur.fetchall())

# zip prize list with projects, tables, and categories for each prize. Each element of this list is
# (prize name, names and table numbers of each project submitted for this prize that this judge is judging, scoring categories for this prize)
Expand Down
4 changes: 2 additions & 2 deletions frontend/templates/judge_score.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ <h2> {{prize}} </h2>
<tr>
<td> {{project['project_name']}} </td>
<td> {{project['table_num']}} </td>
{% for category in categories %}
<td> <input type="number" id="number" name="{{prize}}|{{project['project_id']}}|{{category}}" placeholder="{{category}}"> </td>
{% for category in categories %}
<td> <input type="number" id="number" min="{{category['min_score']}}" max="{{category['max_score']}}" name="score{{project['table_num']}}{{category['category_name']}}" placeholder="{{category['category_name']}}"> </td>
{% endfor %}
</tr>
{% endfor %}
Expand Down