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

feat: Create DRF for course grading (#32399) #549

Merged

Conversation

kaustavb12
Copy link
Member

@kaustavb12 kaustavb12 commented Jul 10, 2023

Description

(cherry picked from commit dea67f2)

This PR creates APIs to GET and POST course grade settings. This is a port of the upstream PR openedx#32399

Supporting information

Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.
Be sure to check they are publicly readable, or if not, repeat the information here.

Testing instructions

  1. Setup branch in devstack
  2. Fetch Access Token:
    curl -X POST -d "grant_type=client_credentials&client_id=studio-backend-service-key&client_secret=studio-backend-service-secret&token_type=jwt" http://localhost:18000/oauth2/access_token
    
    You will get a response of the format:
    {"access_token": "ACCESS_TOKEN", "expires_in": 36000, "token_type": "JWT", "scope": "read write email profile"}
    
  3. Fetch Course Grade Settings (Replace <ACCESS_TOKEN>)
    curl -X GET -H "Authorization: JWT <ACCESS_TOKEN>" http://localhost:18010/api/contentstore/v1/course_grading/course-v1:edX+DemoX+Demo_Course
    
    You will get response of the format:
    {"graders":[{"type":"Homework","min_count":3,"drop_count":1,"short_label":"Ex","weight":75,"id":0},{"type":"Exam","min_count":1,"drop_count":0,"short_label":"","weight":25,"id":1}],"grade_cutoffs":{"A":0.8, "B": 0.6},"grace_period":{"hours":5,"minutes":0},"minimum_grade_credit":0.8,"is_credit_course":false}
    
  4. Change Course Grade Settings (Replace <ACCESS_TOKEN>)
    curl -X POST -d '{"graders":[{"type":"Homework","min_count":3,"drop_count":1,"short_label":"Ex","weight":75,"id":0},{"type":"Exam","min_count":1,"drop_count":0,"short_label":"","weight":25,"id":1}],"grade_cutoffs":{"A+":0.9,"A":0.8, "B+":0.7, "B": 0.6, "C": 0.55, "D": 0.5},"grace_period":{"hours":5,"minutes":0},"minimum_grade_credit":0.8}' -H "Authorization: JWT <ACCESS_TOKEN>" -H "Content-Type: application/json" http://localhost:18010/api/contentstore/v1/course_grading/course-v1:edX+DemoX+Demo_Course
    
    You will get response of the format:
    {"graders":[{"type":"Homework","min_count":3,"drop_count":1,"short_label":"Ex","weight":75,"id":0},{"type":"Exam","min_count":1,"drop_count":0,"short_label":"","weight":25,"id":1}],"grade_cutoffs":{"A+":0.9,"A":0.8,"B+":0.7,"B":0.6,"C":0.55,"D":0.5},"grace_period":{"hours":5,"minutes":0},"minimum_grade_credit":0.8}
    

Deadline

"None" if there's no rush, or provide a specific date or event (and reason) if there is one.

Other information

BB-7660

@kaustavb12 kaustavb12 force-pushed the kaustav/cherry_pick_course_grade_api branch from ee193ab to 68d1bc0 Compare July 10, 2023 10:36
@Cup0fCoffee
Copy link
Member

👍

  • I tested this: followed the testing instructions
  • [-] I read through the code
  • Includes documentation
  • I made sure any change in configuration variables is reflected in the corresponding client's configuration-secure repository.

@kaustavb12 kaustavb12 merged commit a30d849 into opencraft-release/nutmeg.2 Jul 10, 2023
30 checks passed
@kaustavb12 kaustavb12 deleted the kaustav/cherry_pick_course_grade_api branch July 10, 2023 13:12
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.

3 participants