Commit 18d68cdc authored by Radheshhathwar's avatar Radheshhathwar
Browse files

Bulk upload with multiple exams

1 merge request!182Bulk upload with multiple exams
Showing with 8 additions and 7 deletions
+8 -7
......@@ -39,11 +39,12 @@ public interface StudentResultRepository extends JpaRepository<StudentResult, Lo
@Transactional
@Query("UPDATE StudentResult sr SET sr.externalMarks = null, sr.passingExternalMarks = null, sr.externalMarksObtained = null, sr.finalMarkFlag = false, sr.published = false WHERE sr.examCycle_name = :examCycleName AND sr.instituteId = :instituteId")
int setExternalMarksToNull(@Param("examCycleName") String examCycleName, @Param("instituteId") Long instituteId);
@Query("SELECT sr FROM StudentResult sr WHERE sr.firstName = :firstName AND sr.lastName = :lastName AND sr.enrollmentNumber = :enrollmentNumber")
StudentResult findByFirstNameAndLastNameAndEnrollmentNumber(
@Query("SELECT sr FROM StudentResult sr WHERE sr.firstName = :firstName AND sr.lastName = :lastName AND sr.enrollmentNumber = :enrollmentNumber AND sr.exam_name = :examName")
StudentResult findByFirstNameAndLastNameAndEnrollmentNumberAndExamName(
@Param("firstName") String firstName,
@Param("lastName") String lastName,
@Param("enrollmentNumber") String enrollmentNumber
@Param("enrollmentNumber") String enrollmentNumber,
@Param("examName") String examName
);
Optional<StudentResult> findByExamId(Long id);
......
......@@ -425,7 +425,7 @@ public class DataImporterService {
}
}
if (validationErrors.isEmpty()) {
StudentResult existingEntity = repository.findByFirstNameAndLastNameAndEnrollmentNumber(dto.getFirstName(), dto.getLastName(), dto.getEnrollmentNumber());
StudentResult existingEntity = repository.findByFirstNameAndLastNameAndEnrollmentNumberAndExamName(dto.getFirstName(), dto.getLastName(), dto.getEnrollmentNumber(), dto.getExam_name());
List<StudentResult> marks = calculateResult(existingEntity.getInternalMarks(), existingEntity.getPassingInternalMarks(), existingEntity.getInternalMarksObtained(), existingEntity.getPracticalMarks(),
existingEntity.getPassingPracticalMarks(), existingEntity.getPracticalMarksObtained(), dto.getExternalMarks(), dto.getPassingExternalMarks(), dto.getExternalMarksObtained());
......@@ -483,7 +483,7 @@ public class DataImporterService {
}
}
if (validationErrors.isEmpty()) {
StudentResult existingEntity = repository.findByFirstNameAndLastNameAndEnrollmentNumber(dto.getFirstName(), dto.getLastName(), dto.getEnrollmentNumber());
StudentResult existingEntity = repository.findByFirstNameAndLastNameAndEnrollmentNumberAndExamName(dto.getFirstName(), dto.getLastName(), dto.getEnrollmentNumber(),dto.getExam_name());
List<StudentResult> marks = calculateResult(existingEntity.getInternalMarks(), existingEntity.getPassingInternalMarks(), existingEntity.getInternalMarksObtained(), existingEntity.getPracticalMarks(),
existingEntity.getPassingPracticalMarks(), existingEntity.getPracticalMarksObtained(), dto.getExternalMarks(), dto.getPassingExternalMarks(), dto.getExternalMarksObtained());
......
......@@ -659,7 +659,7 @@ public class StudentResultService {
// Handle unsupported file type
return ResponseDto.setErrorResponse(response, "UNSUPPORTED_FILE_TYPE", "Unsupported file type", HttpStatus.BAD_REQUEST);
}
String[] selectedColumns = { "First Name", "Last Name", "Enrolment Number","External Marks", "Passing External Marks", "External Marks Obtained" };
String[] selectedColumns = { "First Name", "Last Name", "Enrolment Number", "Exam", "External Marks", "Passing External Marks", "External Marks Obtained" };
JSONArray filteredJsonArray = dataImporterService.filterColumns(jsonArray, selectedColumns);
List<StudentResult> dtoList = dataImporterService.convertJsonToDtoList(filteredJsonArray, StudentResult.class);
ValidationResultDto validationResult = dataImporterService.convertResultDtoListToEntitiesExternalMarks(dtoList, studentResultRepository);
......@@ -698,7 +698,7 @@ public class StudentResultService {
// Handle unsupported file type
return ResponseDto.setErrorResponse(response, "UNSUPPORTED_FILE_TYPE", "Unsupported file type", HttpStatus.BAD_REQUEST);
}
String[] selectedColumns = { "First Name", "Last Name", "Enrolment Number","External Marks", "Passing External Marks", "External Marks Obtained" };
String[] selectedColumns = { "First Name", "Last Name", "Enrolment Number", "Exam", "External Marks", "Passing External Marks", "External Marks Obtained" };
JSONArray filteredJsonArray = dataImporterService.filterColumns(jsonArray, selectedColumns);
List<StudentResult> dtoList = dataImporterService.convertJsonToDtoList(filteredJsonArray, StudentResult.class);
ValidationResultDto validationResult = dataImporterService.convertResultDtoListToEntitiesRevisedMarks(dtoList, studentResultRepository);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment