Skip to content

Commit

Permalink
Misc. changes + optimize getTopicsFromUser
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen-nathan committed Dec 19, 2024
1 parent 65706c5 commit d454114
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
6 changes: 3 additions & 3 deletions api/v2/Routes/students/masterymapping/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ const router = Router({ mergeParams: true });

function getTopicsFromUser(gradeData) {
const topicsTable = {};
Object.entries(gradeData).forEach(([assignment, topics]) => {
Object.entries(topics).forEach(([topic, score]) => {
Object.entries(gradeData)
.flatMap(([assignment, topics]) => Object.entries(topics))
.forEach(([topic, score]) => {
if (topic in topicsTable) {
topicsTable[topic] += +(score ?? 0);
} else {
topicsTable[topic] = +(score ?? 0);
}
});
});
return topicsTable;
}

Expand Down
3 changes: 3 additions & 0 deletions api/v2/Routes/students/progressquerystring/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @deprecated This file is deprecated. It contains logic to produce a query string for CM, which is no longer used.
*/
import { Router } from 'express';
import {
getMaxScores,
Expand Down
7 changes: 6 additions & 1 deletion progressReport/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import parser
import jsonschema
from deprecated import deprecated

"""
Dream Team GUI
Expand Down Expand Up @@ -98,10 +99,12 @@ def validate_mastery_learning_post_request(request_as_json):
jsonschema.validate(instance=request_as_json, schema=schema)

"""
This method is deprecated. Query parameters are no longer used.
This method is deprecated.
"""
@deprecated(reason="Query parameters are no longer used.")
@app.route('/', methods=["GET"])
def index():
print("In index")
def assign_node_levels(node, student_levels_count, class_levels_count):
nonlocal student_mastery, class_mastery
if not node["children"]:
Expand Down Expand Up @@ -163,7 +166,9 @@ def assign_node_levels(node, student_levels_count, class_levels_count):

@app.route('/', methods=["POST"])
def generate_cm_from_post_parameters():
print("In generate_cm_from_post_parameters")
request_as_json = request.get_json()
print("Request", request)
validate_mastery_learning_post_request(request_as_json)
school_name = request_as_json.get("school", DEFAULT_SCHOOL)
course_name = request_as_json.get("class", DEFAULT_CLASS)
Expand Down
1 change: 1 addition & 0 deletions progressReport/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ Flask
gunicorn
Werkzeug
jsonschema
deprecated

0 comments on commit d454114

Please sign in to comment.