edx-platform icon indicating copy to clipboard operation
edx-platform copied to clipboard

upgrade get_students_features api with DRF( 7th api )

Open awais786 opened this issue 1 year ago • 1 comments

Issue

Step to verify using postman

  1. Try this URL in postman http://local.edly.io:8000/courses/course-v1:edx+cs222+2311/instructor/api/get_students_features/csv

expected result. It will trigger the celery task and csv file will appear inside admin portal in instructor dashboard.

Without csv param

  1. Try this URL in postman http://local.edly.io:8000/courses/course-v1:edx+cs222+2311/instructor/api/get_students_features/

expected result.
It will return json response

{
  "course_id": "course-v1:edx+cs222+2311",
  "students": [
    {
      "id": "4",
      "username": "admin",
      "email": "[email protected]",
      "date_joined": "2024-07-04T08:26:43Z",
      "last_login": "2024-08-18T18:48:11.680Z",
      "name": "",
      "language": "",
      "location": "",
      "gender": "None",
      "level_of_education": "None",
      "mailing_address": "None",
      "goals": "None",
      "city": "None",
      "country": "",
      "cohort": "[unassigned]",
      "enrollment_mode": "audit",
      "external_user_key": ""
    },
    {
      "id": "7",
      "username": "awaisq",
      "email": "[email protected]",
      "date_joined": "2024-07-31T08:04:28Z",
      "last_login": "None",
      "name": "",
      "language": "",
      "location": "",
      "gender": "None",
      "level_of_education": "None",
      "mailing_address": "",
      "goals": "aa",
      "city": "",
      "country": "",
      "cohort": "[unassigned]",
      "enrollment_mode": "audit",
      "external_user_key": ""
    }
  ],
  "students_count": 3,
  "queried_features": [
    "id",
    "username",
    "name",
    "email",
    "language",
    "location",
    "gender",
    "level_of_education",
    "mailing_address",
    "goals",
    "enrollment_mode",
    "last_login",
    "date_joined",
    "external_user_key",
    "cohort",
    "city",
    "country"
  ],
  "feature_names": {
    "id": "User ID",
    "username": "Username",
    "name": "Name",
    "email": "Email",
    "language": "Language",
    "location": "Location",
    "gender": "Gender",
    "level_of_education": "Level of Education",
    "mailing_address": "Mailing Address",
    "goals": "Goals",
    "enrollment_mode": "Enrollment Mode",
    "last_login": "Last Login",
    "date_joined": "Date Joined",
    "external_user_key": "External User Key",
    "cohort": "Cohort",
    "city": "City",
    "country": "Country"
  },
  "available_features": [
    "id",
    "username",
    "first_name",
    "last_name",
    "is_staff",
    "email",
    "date_joined",
    "last_login",
    "name",
    "language",
    "location",
    "year_of_birth",
    "gender",
    "level_of_education",
    "mailing_address",
    "goals",
    "meta",
    "city",
    "country",
    "external_user_key"
  ]
}

Step to verify on dashboard

  1. open this URL instructor page-> data-download.
  2. Click the button Download profile information as a CSV.

It will down the file contains

id,username,name,email,language,location,gender,level_of_education,mailing_address,goals,enrollment_mode,last_login,date_joined,external_user_key,cohort,city,country
4,admin,,[email protected],,,None,None,None,None,audit,2024-08-18 18:48:11.680830+00:00,2024-07-04 08:26:43+00:00,,[unassigned],None,
5,audot,Awais Qureshi,[email protected],,,m,p,lahore,,audit,2024-07-27 10:40:35+00:00,2024-07-27 10:37:58+00:00,,[unassigned],,PK
7,awaisq,,[email protected],,,None,None,,aa,audit,None,2024-07-31 08:04:28+00:00,,[unassigned],,
Screenshot 2024-08-19 at 2 42 32 PM

awais786 avatar Aug 19 '24 09:08 awais786

@feanil Please review.

awais786 avatar Aug 22 '24 07:08 awais786

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

edx-pipeline-bot avatar Oct 07 '24 12:10 edx-pipeline-bot

2U Release Notice: This PR has been deployed to the edX production environment.

edx-pipeline-bot avatar Oct 07 '24 14:10 edx-pipeline-bot

2U Release Notice: This PR has been deployed to the edX production environment.

edx-pipeline-bot avatar Oct 07 '24 14:10 edx-pipeline-bot