Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
examsAndAdmissions
Commits
18d68cdc
Commit
18d68cdc
authored
1 year ago
by
Radheshhathwar
Browse files
Options
Download
Patches
Plain Diff
Bulk upload with multiple exams
parent
9aef4434
github/fork/ruksana2808/filter_bug_examCycle
development
1 merge request
!182
Bulk upload with multiple exams
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/java/com/tarento/upsmf/examsAndAdmissions/repository/StudentResultRepository.java
+4
-3
...xamsAndAdmissions/repository/StudentResultRepository.java
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/DataImporterService.java
+2
-2
...upsmf/examsAndAdmissions/service/DataImporterService.java
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/StudentResultService.java
+2
-2
...psmf/examsAndAdmissions/service/StudentResultService.java
with
8 additions
and
7 deletions
+8
-7
src/main/java/com/tarento/upsmf/examsAndAdmissions/repository/StudentResultRepository.java
+
4
−
3
View file @
18d68cdc
...
...
@@ -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
findByFirstNameAndLastNameAndEnrollmentNumber
AndExamName
(
@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
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/DataImporterService.java
+
2
−
2
View file @
18d68cdc
...
...
@@ -425,7 +425,7 @@ public class DataImporterService {
}
}
if
(
validationErrors
.
isEmpty
())
{
StudentResult
existingEntity
=
repository
.
findByFirstNameAndLastNameAndEnrollmentNumber
(
dto
.
getFirstName
(),
dto
.
getLastName
(),
dto
.
getEnrollmentNumber
());
StudentResult
existingEntity
=
repository
.
findByFirstNameAndLastNameAndEnrollmentNumber
AndExamName
(
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
.
findByFirstNameAndLastNameAndEnrollmentNumber
AndExamName
(
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
());
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/StudentResultService.java
+
2
−
2
View file @
18d68cdc
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets