Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Currently, only trackable collections and their progress are stored in user_activity_agg table.
Below is the flow used to show scores in group aggregates.

...

AssessmentAggregator job changes:

...

activity_type

activity_id

user_id

context_id

agg

agg_last_updated

Assessment

do_123(assessmentId)Course

collectionId

user_123

cb:batch_123

{'score:assessmentId_1': <best attempted score>,
'score:assessmentId_2': <best attempted score>}

{'score:assessmentId_1': ‘timestamp’,
'score:assessmentId_2':: ‘timestamp’}

Group Aggregate API changes:

Create a new v2 endpoint and accept list of activityIds in the input and response is based on the activityId.
Each activity data for a group is cached with key groupId:activityId:activityType:activity-agg and TTL of 1hr.

Request:

...

Implementation steps:

  • Read the best score from assessment_aggregate table using courseId, userId, batchId and contentId from the event

  • Partial update the agg and agg_last_updated columns in user_activity_agg

Group Aggregate API changes:

The response contains the score aggregates also if the collection contains self assessments.

Response:

Code Block
{
    "id": "api.group.activity.agg",
    "ver": "v2v1",
    "ts": "2021-04-0714 0517:5349:3230:742782+00000530",
    "params": {
        "resmsgid": null,
        "msgid": "62ae69c970b89413-edf7fe1f-4486482a-bbfcb92a-c84454add954e27d4af0ae4f",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
  "result": {
    "activitiesresult": [
      {
        "activity": {
            "id": "assessmentId_1collectionId",
            "type": "AssessmentCourse",
            "agg": [

           {     {
         "metric": "score",               "lastUpdatedOnmetric": 1596647700613,
              "value": 1"enrolmentCount",
             }       "lastUpdatedOn": 1618390479814,
  ]         },         "groupIdvalue": "b0c4a645-807e-41c7-972e-5c48c5b5e5e7",
   1 <totla number of enrolments>
    "members": [           {}
            "agg":]
[        },
      {       "groupId": "groupId",
         "metricmembers": "score",[
            {
   "value": 20,            "agg": [
   "lastUpdatedOn": 1596647700613               } {
           ],             "namemetric": "CreationcompletedCount",

           "role": "admin",             "statusvalue": "active"2,
            "createdBy": "874ed8a5-782e-4f6c-8f36-e0288455901e",             "userIdlastUpdatedOn": "874ed8a5-782e-4f6c-8f36-e0288455901e"1596647700613
          }         ] },
     },       {        {
"activity": {           "id": "assessmentId_2",           "typemetric": "Assessmentscore:assessmentId_1",
          "agg": [             {
     "value": 10, <best attempted score>
        "metric": "score",               "lastUpdatedOn": 1596647700613,1618390479814
              "value": 1     },
       }           ]  {
      },         "groupId": "b0c4a645-807e-41c7-972e-5c48c5b5e5e7",        "metric": "members": [score:assessmentId_2",
           {             "aggvalue": [20, <best attempted score>
           {                 "metriclastUpdatedOn": "score",
  1618390479814
             "value": 30,          }
      "lastUpdatedOn": 1596647700613               }
        ],
   ],             "name": "Creation",
                "role": "admin",
                "status": "active",
                "createdBy": "874ed8a5-782e-4f6c-8f36-e0288455901euserId",
                "userId": "874ed8a5-782e-4f6c-8f36-e0288455901euserId"
            }
        ]
      }
    ]   }
}