...
Pros | Cons |
---|---|
As get course has meta data to indicate open batch count per installation, so no need to make any extra api call |
|
2. Data is updated by scheduler job and scheduler job is not 100% guaranteed | |
3. Some time due to content attribute changes , it's not able to update the content, so in that case meta data won't be updated. 4. TO add meta data for upcoming batch as well , will have more complexity to manage it when upcoming batch changes as ongoing. |
Note : So to support solution 1: we need to take following actions:
...
Actions |
---|
|
Proposed Solution 2:
User can make another api as batch search api by passing all courseIds and some extra filters.
Sunbird will expose a new api to get open batch count for list for ongoing and upcoming batches. New api details will be as follows:
Code Block | ||||||
---|---|---|---|---|---|---|
| {
| |||||
URI: /course/v1/search Methods: POST Request body: { "request": { "filters":{ "courseId" : ["do_112634552998936576175","do_112634535631675392173","do_112633845274157056122"], "status":["0","1"], "enrollmentType":["open"] }, "sort_by":{"createdDate":"desc"} } } |
...
- Existing api can be re-used.
...
- Caller (portal/app) need to make one extra api call and then then need to merge both response
- Caller need to make one more api call to get my enroll course
- It can have performance issues .
Proposed Solution 3:
Sunbird will expose a new api to get open batch count for list of courseIds. New api details will be as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
URI: v1/course/batch/count Methods: POST Request body 1: { "request": { "filters": "offset":0, "limit":20, "facets":[{"courseId":null}] } } --- Internal work flow : When user call this api , it will do course batch search under ES and all unique courseIds. After getting list of unique courseIds , it will make call to Content search api by passing all those courseIds and Content search response will be provided to caller. Internal Api call URI: /content/v1/search Method: POST Request body: {"request":{"filters":{"identifier": ["list of courseId"]},"sort_by":{"createdOn":"desc"}}} ---- Response: { "id": "api.course.search", "ver": "v1", "ts": "2018-11-20 17:53:00:716+0000", "params": { "resmsgid": null, "msgid": "8e27cbf5-e299-43b0-bca7-8347f7e5abcf", "err": null, "status": "success", "errmsg": null }, "responseCode": "OK", "result": { "response": { "count": 8, "content": [ { "courseIdownershipType": ["courseId-1","courseId-2"] "createdFor" ], "subject": "Science", "channel": "0124511325012951040", "downloadUrl": "https://sunbirdstaging.blob.core.windows.net/sunbird-content-staging/ecar_files/do_2126299478299033601672/course-rf-09112018-2_1541742032021_do_2126299478299033601672_1.0_spine.ecar", "statusorganisation": ["0","1"], "SunbirdQA 1", "Sunbird QA Tenant" ], "enrollmentTypelanguage":"open [ "English" ], } } } Request body 2: {"mimeType": "application/vnd.ekstep.content-collection", "requestvariants": { "filtersspine": { "courseIdecarUrl":["courseId-1","courseId-2"] "https://sunbirdstaging.blob.core.windows.net/sunbird-content-staging/ecar_files/do_2126299478299033601672/course-rf-09112018-2_1541742032021_do_2126299478299033601672_1.0_spine.ecar", "size": 167578 } } }, Request body 3: {"objectType": "Content", "request": { gradeLevel": [ "Class 9" ], "appIcon": "https://sunbirdstaging.blob.core.windows.net/sunbird-content-staging/content/do_2126299478299033601672/artifact/1193-600x337_1524060806727.thumb.jpg", "courseIdchildren": ["courseId-1","courseId-2"]], "appId": "staging.sunbird.app", "contentEncoding": "gzip", "mimeTypesCount": "{\"application/vnd.ekstep.html-archive\":1,\"video/webm\":1,\"application/vnd.ekstep.content-collection\":1,\"video/mp4\":1}", "contentType": "Course", "identifier": "do_2126299478299033601672", "lastUpdatedBy": "bf622d07-ca95-4cc1-9a49-a4518925a4d8", "audience": [ "Learner" ], "visibility": "Default", "toc_url": "https://sunbirdstaging.blob.core.windows.net/sunbird-content-staging/content/do_2126299478299033601672/artifact/do_2126299478299033601672toc.json", "contentTypesCount": "{\"CourseUnit\":1,\"Resource\":3} }", "consumerId": "dc56def7-ecfd-4001-ab2f- Response: {d98251ed40e2", "childNodes": [ "do_2123236738896609281243", "do_2123717816919900161187", "do_2126299480633671681673", "do_2123717841558814721189" ], "mediaType": "content", "idosId": "apiorg.courseekstep.batch.count",quiz.app", "graph_id": "domain", "nodeType": "DATA_NODE", "lastPublishedBy": "9ac4ea92-fea7-45e6-93f3-02aa3172ea58", "verprevState": "Review", "v1size": 167578, "tslastPublishedOn": "2018-11-20 17:53:00:716+0000",09T05:40:31.997+0000", "IL_FUNC_OBJECT_TYPE": "Content", "name": "Course RF 09112018 2", "status": "Live", "code": "org.sunbird.ZwEKh2", "description": "Enter description for Course", "paramsmedium": { "Hindi", "resmsgididealScreenSize": null,"normal", "msgidposterImage": "8e27cbf5-e299-43b0-bca7-8347f7e5abcf",https://ekstep-public-qa.s3-ap-south-1.amazonaws.com/content/do_21248510612742144014185/artifact/1193-600x337_1524060806727.jpg", "errcreatedOn": null,"2018-11-09T05:34:38.454+0000", "statuscontentDisposition": "successinline", "lastUpdatedOn"errmsg": null: "2018-11-09T05:40:31.194+0000", },"SYS_INTERNAL_LAST_UPDATED_ON": "2018-11-09T08:00:00.413+0000", "responseCode "owner": "OKSunbird QA Tenant", "resultcreator": { "JP Mentor ORg1 user", "response": {createdFor": [ "012451141730410496558", "0124511325012951040" ], "countIL_SYS_NODE_TYPE": 8,"DATA_NODE", "contentos": [ "All" { ], "courseId": "do_2126299478299033601672", c_Sunbird_Staging_open_batch_count": 1, "pkgVersion": 1, "versionKey": "1541742031194", "openBatchCountidealScreenDensity":2, "hdpi", "framework": "rj_k-12_1", "inviteOnlyBatchCounts3Key": "ecar_files/do_2126299478299033601672/course-rf-09112018-2_1541742032021_do_2126299478299033601672_1.0_spine.ecar", "lastSubmittedOn": "2018-11-09T05:39:35.246+0000", },"createdBy": "bf622d07-ca95-4cc1-9a49-a4518925a4d8", "compatibilityLevel": 4, { "leafNodesCount": 3, "courseIdIL_UNIQUE_ID": "do_2126299478299033601672", "ownedBy": "0124511325012951040", "openBatchCountboard":2, "State (Rajasthan)", "resourceType": "Course", "inviteOnlyBatchCountnode_id":0 430981 } , {} ] } } } |
Pros | Cons |
---|---|
|
|
** Search open batch based on filter will have issues.
Proposed Solution 3:
Sunbird will define new page section to provide open course list under page api.
TO achieve this we need to do following modification under page assemble api and get page section .
* Now section table need to have calling source as well. which will include (source, indexName, typeName)
* Assemble page business logic will be modified to make call based on source
* local source can have multiple search query with query order.
Pros | Cons |
---|---|
|
|
Proposed Solution 4:
User can make another api as batch search api by passing all courseIds and some extra filters.
Code Block | ||||
---|---|---|---|---|
| ||||
{"request":{"filters":{ "courseId" : ["do_112634552998936576175","do_112634535631675392173","do_112633845274157056122"],"status":["0","1"],"enrollmentType":"open"},
"sort_by":{"createdDate":"desc"}
}
} |
Pros | Cons |
---|---|
|
|
Open Questions :
- If one course have 3 open batches and caller already enrolled for one batch then do we need to sent open batch count as 3 or 2 or for him there is no open batch to do enroll.
...