Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Backend implemention V0.15.2: Fix mismatched argument in cur.execute.
Browse files Browse the repository at this point in the history
  • Loading branch information
saitewasreset committed Dec 6, 2023
1 parent 42c872e commit 19e0378
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
10 changes: 1 addition & 9 deletions backend/app/daemon/scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ def get_chart_data_by_subject(subject_id, class_id):
db = get_db()
cur = db.cursor()
class_data = {}
current_app.logger.error("alfjsslajfdg")
if subject_id != 255:
class_avg_sql = "SELECT exam_id, AVG(value) " \
"FROM scores " \
Expand Down Expand Up @@ -254,7 +253,6 @@ def get_chart_data_by_subject(subject_id, class_id):
class_data[exam_id]["first10AvgScoreRank"] = get_grade_rank(cur, subject_id, exam_id,
class_data[exam_id]["first10AvgScore"])
class_data[exam_id]["first10std"] = numpy.std(score_lst)
current_app.logger.error("xxxxx:{}".format(class_data))
for exam_id in class_data.keys():
last10_data_sql = "SELECT value " \
"FROM scores " \
Expand All @@ -267,10 +265,6 @@ def get_chart_data_by_subject(subject_id, class_id):
"LIMIT 10"
cur.execute(last10_data_sql, (exam_id, subject_id, class_id))
data = list(cur)
current_app.logger.error(exam_id)
current_app.logger.error(subject_id)
current_app.logger.error(class_id)
current_app.logger.error(data)
score_lst = [x[0] for x in data]
class_data[exam_id]["last10AvgScore"] = numpy.average(score_lst)
class_data[exam_id]["last10AvgScoreRank"] = get_grade_rank(cur, subject_id, exam_id,
Expand Down Expand Up @@ -322,7 +316,7 @@ def get_chart_data_by_subject(subject_id, class_id):
"GROUP BY student_id " \
"ORDER BY SUM(value) DESC " \
"LIMIT 10"
cur.execute(class_total_first10_data_sql, (exam_id, class_id))
cur.execute(class_total_first10_data_sql, (exam_id, class_id, exam_id))
score_lst = [x[0] for x in list(cur)]
if len(score_lst) == 0:
continue
Expand All @@ -342,8 +336,6 @@ def get_chart_data_by_subject(subject_id, class_id):
"LIMIT 10"
cur.execute(class_total_last10_data_sql, (exam_id, class_id, exam_id))
data = list(cur)
current_app.logger.error(exam_id)
current_app.logger.error(data)
score_lst = [x[0] for x in data]
if len(score_lst) == 0:
continue
Expand Down
4 changes: 2 additions & 2 deletions backend/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Backend Daemon V0.15.1
# Backend Daemon V0.15.2

- Fix Nan when class_data[exam_id]["last10AvgScore"] is [].
- Fix mismatched argument in cur.execute.

# API V0.15.0

Expand Down

0 comments on commit 19e0378

Please sign in to comment.