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

[PPS] Added endpoint to get all reports of student in JSON #20

Merged
merged 3 commits into from
Mar 21, 2023

Conversation

pritamps
Copy link
Contributor

@pritamps pritamps commented Mar 9, 2023

  • Added a new secondary index to dynamodb -- our reports db is now queryable by userid as well
  • Added a new endpoint: /reports/student_reports/4444444444?format=json
    Sample output:
{"student_id":"4444444444","reports":[{"test_name":"Test - Homework Quiz","test_session_id":"Test_-_Homework_Quiz_2022-07-27_62e246c6ed7e4cbb6a78b823","rank":"1.0","percentile":80,"report_link":"https://reports.avantifellows.org/reports/student_quiz_report/Test_-_Homework_Quiz_2022-07-27_62e246c6ed7e4cbb6a78b823/4444444444"},{"test_name":"Test - Homework Quiz","test_session_id":"Test_-_Homework_Quiz_2022-07-27_62e246c6ed7e4cbb6a78b823","rank":"1.0","percentile":90,"report_link":"https://reports.avantifellows.org/reports/student_quiz_report/Test_-_Homework_Quiz_2022-07-27_62e246c6ed7e4cbb6a78b823/4444444444"},{"test_name":"Test - Homework Quiz","test_session_id":"Test_-_Homework_Quiz_2022-07-27_62e246c6ed7e4cbb6a78b823","rank":"2.0","percentile":80,"report_link":"https://reports.avantifellows.org/reports/student_quiz_report/Test_-_Homework_Quiz_2022-07-27_62e246c6ed7e4cbb6a78b823/4444444444"},{"test_name":"Test - Homework Quiz","test_session_id":"Test_-_Homework_Quiz_2022-07-27_62e246c6ed7e4cbb6a78b823","rank":"3.0","percentile":40,"report_link":"https://reports.avantifellows.org/reports/student_quiz_report/Test_-_Homework_Quiz_2022-07-27_62e246c6ed7e4cbb6a78b823/4444444444"}]}
``



def drop_secondary_ind():
drop_secondary_index("gsi_user_id-section")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be "gsi_user_Id"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So these methods are meant to be run manually, mostly one-time. Will actually make this a parameter for the function.

@@ -35,5 +40,15 @@ def drop_tables():
drop_student_quiz_reports(ddb)


def add_secondary_ind():
# DON'T RUN THIS for the key user_id key as it's already been run
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this is getting run by default in `if name == "main" ? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comment explaining things

"""
Drops a secondary index
"""
drop_secondary_index(index_name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

drop_secondary_index(ddb, index_name)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and ddb = initialize_db()

@pritamps pritamps temporarily deployed to Staging March 21, 2023 08:23 — with GitHub Actions Inactive
@pritamps pritamps merged commit e9a49a3 into main Mar 21, 2023
@pritamps pritamps deleted the add-endpoint-for-all-student-reports branch March 21, 2023 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants