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
fb90d26d
Unverified
Commit
fb90d26d
authored
1 year ago
by
Ankit Verma
Committed by
GitHub
1 year ago
Browse files
Options
Download
Plain Diff
Merge pull request #183 from Radheshhathwar/development
Hall ticket and Attendance changes
parents
9b3b0461
d0488869
github/fork/ruksana2808/filter_bug_examCycle
development
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
src/main/java/com/tarento/upsmf/examsAndAdmissions/controller/HallTicketController.java
+2
-2
...f/examsAndAdmissions/controller/HallTicketController.java
src/main/java/com/tarento/upsmf/examsAndAdmissions/repository/AttendanceRepository.java
+1
-1
...f/examsAndAdmissions/repository/AttendanceRepository.java
src/main/java/com/tarento/upsmf/examsAndAdmissions/repository/DataCorrectionRequestRepository.java
+5
-0
...dmissions/repository/DataCorrectionRequestRepository.java
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/AttendanceService.java
+2
-1
...o/upsmf/examsAndAdmissions/service/AttendanceService.java
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/DataImporterService.java
+1
-1
...upsmf/examsAndAdmissions/service/DataImporterService.java
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/HallTicketService.java
+10
-4
...o/upsmf/examsAndAdmissions/service/HallTicketService.java
with
21 additions
and
9 deletions
+21
-9
src/main/java/com/tarento/upsmf/examsAndAdmissions/controller/HallTicketController.java
+
2
−
2
View file @
fb90d26d
...
...
@@ -103,8 +103,8 @@ public class HallTicketController {
@GetMapping
(
"/dataCorrection/requests"
)
public
ResponseEntity
<
ResponseDto
>
viewDataCorrectionRequests
()
{
ResponseDto
responseDto
=
hallTicketService
.
getAllDataCorrectionRequests
();
public
ResponseEntity
<
ResponseDto
>
viewDataCorrectionRequests
(
@RequestParam
(
value
=
"examCycleId"
,
required
=
false
)
Optional
<
Long
>
examCycleId
)
{
ResponseDto
responseDto
=
hallTicketService
.
getAllDataCorrectionRequests
(
examCycleId
);
return
ResponseEntity
.
status
(
responseDto
.
getResponseCode
().
value
()).
body
(
responseDto
);
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/upsmf/examsAndAdmissions/repository/AttendanceRepository.java
+
1
−
1
View file @
fb90d26d
...
...
@@ -8,7 +8,7 @@ import java.util.List;
@Repository
public
interface
AttendanceRepository
extends
JpaRepository
<
AttendanceRecord
,
Long
>
{
boolean
existsByStudentEnrollmentNumber
(
String
studentEnrollmentNumber
);
boolean
existsByStudentEnrollmentNumber
AndExamCycleData
(
String
studentEnrollmentNumber
,
String
examCycleName
);
AttendanceRecord
findByStudentEnrollmentNumber
(
String
studentEnrollmentNumber
);
List
<
AttendanceRecord
>
findByExamCycleId
(
Long
examCycleId
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/upsmf/examsAndAdmissions/repository/DataCorrectionRequestRepository.java
+
5
−
0
View file @
fb90d26d
...
...
@@ -4,7 +4,12 @@ import com.tarento.upsmf.examsAndAdmissions.model.dto.DataCorrectionRequest;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Optional
;
@Repository
public
interface
DataCorrectionRequestRepository
extends
JpaRepository
<
DataCorrectionRequest
,
Long
>
{
String
getProofAttachmentPathById
(
Long
requestId
);
List
<
DataCorrectionRequest
>
getByExamCycleId
(
Optional
<
Long
>
examCycleId
);
}
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/AttendanceService.java
+
2
−
1
View file @
fb90d26d
...
...
@@ -65,10 +65,11 @@ public class AttendanceService {
continue
;
// Skip this iteration if the row is empty
}
String
studentEnrollmentNumber
=
getStringValue
(
row
.
getCell
(
2
));
String
examCycleId
=
getStringValue
(
row
.
getCell
(
6
));
AttendanceRecord
record
;
// If record already exists, fetch it, otherwise create a new one
if
(
attendanceRepository
.
existsByStudentEnrollmentNumber
(
studentEnrollmentNumber
))
{
if
(
attendanceRepository
.
existsByStudentEnrollmentNumber
AndExamCycleData
(
studentEnrollmentNumber
,
examCycleId
))
{
record
=
attendanceRepository
.
findByStudentEnrollmentNumber
(
studentEnrollmentNumber
);
}
else
{
record
=
new
AttendanceRecord
();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/DataImporterService.java
+
1
−
1
View file @
fb90d26d
...
...
@@ -777,7 +777,7 @@ public class DataImporterService {
}
private
boolean
checkIfDataExists
(
AttendanceRecord
dto
)
{
return
attendanceRepository
.
existsByStudentEnrollmentNumber
(
dto
.
getStudentEnrollmentNumber
());
return
attendanceRepository
.
existsByStudentEnrollmentNumber
AndExamCycleData
(
dto
.
getStudentEnrollmentNumber
()
,
dto
.
getExamCycleData
()
);
}
private
boolean
checkIfDataExists
(
ExamUploadData
dto
)
{
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/HallTicketService.java
+
10
−
4
View file @
fb90d26d
...
...
@@ -321,9 +321,14 @@ public class HallTicketService {
return
dto
;
}
public
ResponseDto
getAllDataCorrectionRequests
()
{
public
ResponseDto
getAllDataCorrectionRequests
(
Optional
<
Long
>
examCycleId
)
{
ResponseDto
response
=
new
ResponseDto
(
Constants
.
API_HALLTICKET_GET_ALL_DATA_CORRECTION_REQUESTS
);
List
<
DataCorrectionRequest
>
requests
=
dataCorrectionRequestRepository
.
findAll
();
List
<
DataCorrectionRequest
>
requests
;
if
(
examCycleId
.
isPresent
())
{
requests
=
dataCorrectionRequestRepository
.
getByExamCycleId
(
examCycleId
);
}
else
{
requests
=
dataCorrectionRequestRepository
.
findAll
();
}
List
<
Map
<
String
,
Object
>>
formattedRequests
=
new
ArrayList
<>();
for
(
DataCorrectionRequest
request
:
requests
)
{
...
...
@@ -340,7 +345,7 @@ public class HallTicketService {
formattedRequest
.
put
(
"lastName"
,
student
.
getSurname
());
// changed from 'surName'
formattedRequest
.
put
(
"enrollmentNumber"
,
student
.
getEnrollmentNumber
());
StudentExamRegistration
registration
=
studentExamRegistrationRepository
.
getByStudentIdAndExamCycleId
(
student
.
getId
(),
request
.
getExamCycle
().
getId
());
StudentExamRegistration
registration
=
studentExamRegistrationRepository
.
getByStudentIdAndExamCycleId
(
student
.
getId
(),
request
.
getExamCycle
().
getId
());
if
(
registration
!=
null
)
{
Map
<
String
,
Object
>
examCycleData
=
new
HashMap
<>();
ExamCycle
examCycle
=
registration
.
getExamCycle
();
...
...
@@ -660,9 +665,10 @@ public class HallTicketService {
private
double
computeAttendancePercentage
(
StudentExamRegistration
registration
)
{
// Fetch the student enrollment number from the associated student
String
studentEnrollmentNumber
=
registration
.
getStudent
().
getEnrollmentNumber
();
String
examCycleData
=
registration
.
getExamCycle
().
getExamCycleName
();
// Check if an attendance record exists for this student enrollment number
if
(!
attendanceRepository
.
existsByStudentEnrollmentNumber
(
studentEnrollmentNumber
))
{
if
(!
attendanceRepository
.
existsByStudentEnrollmentNumber
AndExamCycleData
(
studentEnrollmentNumber
,
examCycleData
))
{
return
0.0
;
}
...
...
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