Skip to content

Commit

Permalink
4.8.15 dev v1 (#584)
Browse files Browse the repository at this point in the history
* KB-4705 | DEV| Assessment | BE | Consumption Logic for the QuestionWeightage Assessment Type (#564)

* Added string handling in admin patch API

* Assessment V5 Changes

Assessment V5 Changes

* KB-4705 | DEV| Assessment | BE | Consumption Logic for the QuestionWeightage Assessment Type

1. Removed the hardcoded attributes and added from assessment hierarchy.

* KB-4705 | DEV| Assessment | BE | Consumption Logic for the QuestionWeightage Assessment Type

1. Added proper comments and logs.
2. Refractored the code.
3. Added logic for optionweightage.

---------

Co-authored-by: karthik-tarento <[email protected]>

* Retry Attempts Enabled for Assessment V5

* KB-4705 | DEV| Assessment | BE | Consumption Logic for the QuestionWeightage Assessment Type (#565)

1. Optional weightage score calculation enhancements.

* Adding the insight API implementation for MDO channel (#571)

* SaveStateMethod

* Maintaining the order of the fields.

* KB-4705 | DEV| Assessment | BE | Consumption Logic for the QuestionWeightage Assessment Type (#580)

1. Enhanchements for questionScheme.

* KB-5130 | DEV| Assessment | BE | Enhancement in Consumption Logic for the QuestionWeightage Assessment Type. (#581)

1. Added logic for new attributes added.
2. Added questionLevel param in Question read API.

* KB-5130 | DEV| Assessment | BE | Enhancement in Consumption Logic for the QuestionWeightage Assessment Type. (#583)

1. Score calculation fix.

---------

Co-authored-by: tarentomaheshvakkund <[email protected]>
Co-authored-by: karthik-tarento <[email protected]>
Co-authored-by: saipradeep_ravipati <[email protected]>
  • Loading branch information
4 people authored Jun 5, 2024
1 parent 8edda04 commit 604c6b8
Show file tree
Hide file tree
Showing 10 changed files with 1,472 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.sunbird.assessment.service.AssessmentService;
import org.sunbird.assessment.service.AssessmentServiceV2;
import org.sunbird.assessment.service.AssessmentServiceV4;
import org.sunbird.assessment.service.AssessmentServiceV5;
import org.sunbird.common.model.SBApiResponse;
import org.sunbird.common.util.Constants;

Expand All @@ -28,6 +29,9 @@ public class AssessmentController {
@Autowired
AssessmentServiceV4 assessmentServiceV4;

@Autowired
AssessmentServiceV5 assessmentServiceV5;

/**
* validates, submits and inserts assessments and quizzes into the db
*
Expand Down Expand Up @@ -216,4 +220,53 @@ public ResponseEntity<?> readWheebox(@RequestHeader("x-authenticated-user-token"
SBApiResponse response = assessmentServiceV4.readWheebox(authUserToken);
return new ResponseEntity<>(response, response.getResponseCode());
}

@GetMapping("/v5/quml/assessment/read/{assessmentIdentifier}")
public ResponseEntity<SBApiResponse> readAssessmentV5(
@PathVariable("assessmentIdentifier") String assessmentIdentifier,
@RequestHeader(Constants.X_AUTH_TOKEN) String token,@RequestParam(name = "editMode" ,required = false) String editMode) {
boolean edit = !StringUtils.isEmpty(editMode) && Boolean.parseBoolean(editMode);
SBApiResponse readResponse = assessmentServiceV5.readAssessment(assessmentIdentifier, token,edit);
return new ResponseEntity<>(readResponse, readResponse.getResponseCode());
}

@PostMapping("/v5/quml/question/list")
public ResponseEntity<SBApiResponse> readQuestionListV5(@Valid @RequestBody Map<String, Object> requestBody,
@RequestHeader("x-authenticated-user-token") String authUserToken,@RequestParam(name = "editMode" ,required = false) String editMode) {
boolean edit = !StringUtils.isEmpty(editMode) && Boolean.parseBoolean(editMode);
SBApiResponse response = assessmentServiceV5.readQuestionList(requestBody, authUserToken,edit);
return new ResponseEntity<>(response, response.getResponseCode());
}

@PostMapping("/v5/user/assessment/submit")
public ResponseEntity<SBApiResponse> submitUserAssessmentV5(@Valid @RequestBody Map<String, Object> requestBody,
@RequestHeader("x-authenticated-user-token") String authUserToken,@RequestParam(name = "editMode" ,required = false) String editMode) {
boolean edit = !StringUtils.isEmpty(editMode) && Boolean.parseBoolean(editMode);
SBApiResponse submitResponse = assessmentServiceV5.submitAssessmentAsync(requestBody, authUserToken,edit);
return new ResponseEntity<>(submitResponse, submitResponse.getResponseCode());
}

@GetMapping("/v5/quml/assessment/retake/{assessmentIdentifier}")
public ResponseEntity<SBApiResponse> retakeAssessmentV5(
@PathVariable("assessmentIdentifier") String assessmentIdentifier,
@RequestHeader(Constants.X_AUTH_TOKEN) String token,@RequestParam(name = "editMode" ,required = false) String editMode) {
Boolean edit = !StringUtils.isEmpty(editMode) && Boolean.parseBoolean(editMode);
SBApiResponse readResponse = assessmentServiceV5.retakeAssessment(assessmentIdentifier, token,edit);
return new ResponseEntity<>(readResponse, readResponse.getResponseCode());
}

@PostMapping("/v5/quml/assessment/result")
public ResponseEntity<SBApiResponse> readAssessmentResultV5(@Valid @RequestBody Map<String, Object> requestBody,
@RequestHeader("x-authenticated-user-token") String authUserToken) {
SBApiResponse response = assessmentServiceV5.readAssessmentResultV5(requestBody, authUserToken);
return new ResponseEntity<>(response, response.getResponseCode());
}

@PostMapping("/v5/user/assessment/save")
public ResponseEntity<SBApiResponse> saveUserAssessmentV5(@Valid @RequestBody Map<String, Object> requestBody,
@RequestHeader("x-authenticated-user-token") String authUserToken,@RequestParam(name = "editMode" ,required = false) String editMode) {
boolean edit = !StringUtils.isEmpty(editMode) && Boolean.parseBoolean(editMode);
SBApiResponse submitResponse = assessmentServiceV5.submitAssessmentAsync(requestBody, authUserToken,edit);
return new ResponseEntity<>(submitResponse, submitResponse.getResponseCode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,4 +182,5 @@ public Boolean updateUserAssesmentDataToDB(String userId, String assessmentIdent
fieldsToBeUpdated, compositeKeys);
return true;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.sunbird.assessment.service;

import org.sunbird.common.model.SBApiResponse;

import java.util.Map;

public interface AssessmentServiceV5 {

public SBApiResponse readAssessment(String assessmentIdentifier, String token,boolean editMode);

public SBApiResponse readQuestionList(Map<String, Object> requestBody, String authUserToken,boolean editMode);

public SBApiResponse retakeAssessment(String assessmentIdentifier, String token,Boolean editMode);

public SBApiResponse readAssessmentResultV5(Map<String, Object> request, String userAuthToken);

public SBApiResponse submitAssessmentAsync(Map<String, Object> data, String userAuthToken,boolean editMode);

public SBApiResponse saveAssessmentAsync(Map<String, Object> data, String userAuthToken,boolean editMode);

}
Loading

0 comments on commit 604c6b8

Please sign in to comment.