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
2b7355ab
Commit
2b7355ab
authored
1 year ago
by
Radheshhathwar
Browse files
Options
Download
Patches
Plain Diff
Changes for examCyclesByCouses
parent
ec716c7f
github/fork/ruksana2808/filter_bug_examCycle
bug_fix_question_paper_upload
development
1 merge request
!156
Changes for examCyclesByCouses
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/java/com/tarento/upsmf/examsAndAdmissions/repository/StudentResultRepository.java
+4
-1
...xamsAndAdmissions/repository/StudentResultRepository.java
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/ExamCycleService.java
+7
-7
...to/upsmf/examsAndAdmissions/service/ExamCycleService.java
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/StudentResultService.java
+3
-3
...psmf/examsAndAdmissions/service/StudentResultService.java
with
14 additions
and
11 deletions
+14
-11
src/main/java/com/tarento/upsmf/examsAndAdmissions/repository/StudentResultRepository.java
+
4
−
1
View file @
2b7355ab
...
...
@@ -50,7 +50,10 @@ public interface StudentResultRepository extends JpaRepository<StudentResult, Lo
Optional
<
StudentResult
>
findByExamId
(
Long
id
);
List
<
StudentResult
>
findByExamIdAndInstituteId
(
Long
id
,
Long
instituteId
);
@Query
(
"SELECT sr FROM StudentResult sr WHERE sr.exam_name = :examName AND sr.instituteId = :instituteId"
)
List
<
StudentResult
>
findByExamNameAndInstituteId
(
@Param
(
"examName"
)
String
examName
,
@Param
(
"instituteId"
)
Long
instituteId
);
List
<
StudentResult
>
findByExamExamNameAndInstituteId
(
String
examName
,
Long
instituteId
);
List
<
StudentResult
>
findByStudent_EnrollmentNumberAndExamCycle_IdAndPublished
(
String
enrollmentNumber
,
Long
examCycleId
,
boolean
b
);
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/ExamCycleService.java
+
7
−
7
View file @
2b7355ab
...
...
@@ -367,24 +367,24 @@ public class ExamCycleService {
List
<
ExamCycleDTO
>
examCycleDTOs
=
Collections
.
EMPTY_LIST
;
StringBuilder
stringBuilder
=
new
StringBuilder
(
"select * from exam_cycle where date_part('year', start_date) = '"
)
.
append
(
searchExamCycleDTO
.
getStartYear
()).
append
(
"' and obsolete = 0 "
);
try
{
if
(
searchExamCycleDTO
.
getCourseId
()
!=
null
&&
!
searchExamCycleDTO
.
getCourseId
().
isBlank
())
{
try
{
if
(
searchExamCycleDTO
.
getCourseId
()
!=
null
&&
!
searchExamCycleDTO
.
getCourseId
().
isBlank
())
{
stringBuilder
.
append
(
" and course_id = '"
).
append
(
searchExamCycleDTO
.
getCourseId
()).
append
(
"' "
);
}
if
(
searchExamCycleDTO
.
getEndYear
()
!=
null
&&
searchExamCycleDTO
.
getEndYear
()
>
0
)
{
if
(
searchExamCycleDTO
.
getEndYear
()
!=
null
&&
searchExamCycleDTO
.
getEndYear
()
>
0
)
{
stringBuilder
.
append
(
"and date_part('year', end_date) <= '"
).
append
(
searchExamCycleDTO
.
getEndYear
()).
append
(
"' "
);
}
List
<
ExamCycle
>
examCycles
=
jdbcTemplate
.
query
(
stringBuilder
.
toString
(),
new
ResultSetExtractor
<
List
<
ExamCycle
>>()
{
@Override
public
List
<
ExamCycle
>
extractData
(
ResultSet
rs
)
throws
SQLException
,
DataAccessException
{
List
<
ExamCycle
>
examCycleList
=
new
ArrayList
<>();
while
(
rs
.
next
())
{
while
(
rs
.
next
())
{
examCycleList
.
add
(
ExamCycle
.
builder
().
examCycleName
(
rs
.
getString
(
"exam_cycle_name"
)).
id
(
rs
.
getLong
(
"id"
)).
build
());
}
return
examCycleList
;
}
});
if
(
examCycles
!=
null
&&
!
examCycles
.
isEmpty
())
{
if
(
examCycles
!=
null
&&
!
examCycles
.
isEmpty
())
{
examCycleDTOs
=
examCycles
.
stream
().
map
(
record
->
toDTO
(
record
)).
collect
(
Collectors
.
toList
());
}
response
.
put
(
Constants
.
MESSAGE
,
Constants
.
SUCCESS
);
...
...
@@ -399,10 +399,10 @@ public class ExamCycleService {
}
private
void
validateSearchExamCyclePayload
(
SearchExamCycleDTO
searchExamCycleDTO
)
{
if
(
searchExamCycleDTO
==
null
)
{
if
(
searchExamCycleDTO
==
null
)
{
throw
new
InvalidRequestException
(
Constants
.
INVALID_REQUEST_ERROR_MESSAGE
);
}
if
(
searchExamCycleDTO
.
getStartYear
()
==
null
||
searchExamCycleDTO
.
getStartYear
()
<=
0
)
{
if
(
searchExamCycleDTO
.
getStartYear
()
==
null
||
searchExamCycleDTO
.
getStartYear
()
<=
0
)
{
throw
new
InvalidRequestException
(
Constants
.
MISSING_SEARCH_PARAM_START_ACADEMIC_YEAR
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/upsmf/examsAndAdmissions/service/StudentResultService.java
+
3
−
3
View file @
2b7355ab
...
...
@@ -786,7 +786,7 @@ public class StudentResultService {
dto
.
setLastDateToUploadInternalMarks
(
exam
.
getLastDateToUploadMarks
());
// Now check for student results for this exam and institute
List
<
StudentResult
>
resultsForExam
=
studentResultRepository
.
findByExam
Id
AndInstituteId
(
exam
.
get
Id
(),
instituteId
);
List
<
StudentResult
>
resultsForExam
=
studentResultRepository
.
findByExam
Name
AndInstituteId
(
exam
.
get
ExamName
(),
instituteId
);
if
(!
resultsForExam
.
isEmpty
())
{
// If we find any student result records, it means internal marks have been uploaded
...
...
@@ -804,12 +804,12 @@ public class StudentResultService {
response
.
put
(
Constants
.
RESPONSE
,
dtos
);
response
.
setResponseCode
(
HttpStatus
.
OK
);
}
else
{
ResponseDto
.
setErrorResponse
(
response
,
"NO_EXAMS_FOUND"
,
"No exams found for the provided exam cycle."
,
HttpStatus
.
NOT_FOUND
);
return
ResponseDto
.
setErrorResponse
(
response
,
"NO_EXAMS_FOUND"
,
"No exams found for the provided exam cycle."
,
HttpStatus
.
NOT_FOUND
);
}
}
catch
(
Exception
e
)
{
// Handle any unexpected errors that might occur during the process.
ResponseDto
.
setErrorResponse
(
response
,
"INTERNAL_SERVER_ERROR"
,
e
.
getMessage
(),
HttpStatus
.
INTERNAL_SERVER_ERROR
);
return
ResponseDto
.
setErrorResponse
(
response
,
"INTERNAL_SERVER_ERROR"
,
e
.
getMessage
(),
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
return
response
;
...
...
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