Skip to content

Commit

Permalink
Use new tutorial feedback API json
Browse files Browse the repository at this point in the history
  • Loading branch information
bebatut committed Jun 24, 2024
1 parent d7f811c commit 561c313
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions bin/extract_gtn_tutorials.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,16 @@ def get_feedback_per_tutorials() -> Dict:
"""
Get feedback from GTN API and group per tutorial
"""
feedback = get_request_json("https://training.galaxyproject.org/training-material/api/feedback.json")
feedback = get_request_json("https://training.galaxyproject.org/training-material/api/feedback2.json")
feedback_per_tuto = {}
for f in feedback:
tuto = f["tutorial"]
feedback_per_tuto.setdefault(tuto, {"number": 0, "mean note": 0})
feedback_per_tuto[tuto]["number"] += 1
feedback_per_tuto[tuto]["mean note"] += int(f["note"])
for topic, tutorials in feedback.items():
for tuto, feedback in tutorials.items():
for f in feedback:
feedback_per_tuto.setdefault(tuto, {"number": 0, "mean rating": 0})
feedback_per_tuto[tuto]["number"] += 1
feedback_per_tuto[tuto]["mean rating"] += int(f["rating"])
for tuto in feedback_per_tuto:
feedback_per_tuto[tuto]["mean note"] /= feedback_per_tuto[tuto]["number"]
feedback_per_tuto[tuto]["mean rating"] /= feedback_per_tuto[tuto]["number"]
return feedback_per_tuto


Expand Down

0 comments on commit 561c313

Please sign in to comment.