Unverified Commit 63dd47e1 authored by Ankit Verma's avatar Ankit Verma Committed by GitHub
Browse files

Merge pull request #181 from Radheshhathwar/development

Showing with 14 additions and 49 deletions
+14 -49
......@@ -6,6 +6,7 @@ import lombok.*;
import javax.persistence.*;
import java.time.LocalDate;
import java.util.Date;
@Entity
@Table(name = "student_results")
......@@ -87,6 +88,7 @@ public class StudentResult {
private String grade;
@JsonProperty("Result")
private String result;
private Date publishedDate;
@Enumerated(EnumType.STRING)
private ResultStatus status = ResultStatus.ENTERED;
......@@ -97,52 +99,4 @@ public class StudentResult {
private boolean revisedFinalMarkFlag;
private LocalDate lastDateToUploadInternalMarks;
private long instituteId;
public StudentResult(Student student, String firstName, String lastName, String enrollmentNumber,
String motherName, String fatherName, Course course, String course_name,
ExamCycle examCycle, String examCycle_name, Exam exam, String exam_name,
Integer internalMarks, Integer passingInternalMarks, Integer internalMarksObtained,
Integer practicalMarks, Integer passingPracticalMarks, Integer practicalMarksObtained,
Integer otherMarks, Integer passingOtherMarks, Integer otherMarksObtained,
Integer externalMarks, Integer passingExternalMarks, Integer externalMarksObtained,
Integer totalMarks, Integer passingTotalMarks, Integer totalMarksObtained,
String grade, String result, ResultStatus status, boolean published, boolean internalMarkFlag, boolean finalMarkFlag, boolean revisedFinalMarkFlag,LocalDate lastDateToUploadInternalMarks, long instituteId) {
this.student = student;
this.firstName = firstName;
this.lastName = lastName;
this.enrollmentNumber = enrollmentNumber;
this.motherName = motherName;
this.fatherName = fatherName;
this.course = course;
this.course_name = course_name;
this.examCycle = examCycle;
this.examCycle_name = examCycle_name;
this.exam = exam;
this.exam_name = exam_name;
this.internalMarks = internalMarks;
this.passingInternalMarks = passingInternalMarks;
this.internalMarksObtained = internalMarksObtained;
this.practicalMarks = practicalMarks;
this.passingPracticalMarks = passingPracticalMarks;
this.practicalMarksObtained = practicalMarksObtained;
this.otherMarks = otherMarks;
this.passingOtherMarks = passingOtherMarks;
this.otherMarksObtained = otherMarksObtained;
this.externalMarks = externalMarks;
this.passingExternalMarks = passingExternalMarks;
this.externalMarksObtained = externalMarksObtained;
this.totalMarks = totalMarks;
this.passingTotalMarks = passingTotalMarks;
this.totalMarksObtained = totalMarksObtained;
this.grade = grade;
this.result = result;
this.status = status;
this.published = published;
this.internalMarkFlag = internalMarkFlag;
this.finalMarkFlag = finalMarkFlag;
this.revisedFinalMarkFlag = revisedFinalMarkFlag;
this.lastDateToUploadInternalMarks=lastDateToUploadInternalMarks;
this.instituteId=instituteId;
}
}
\ No newline at end of file
......@@ -14,4 +14,5 @@ public class ExamDetailsDTO {
private String result;
private String status;
private Long examId;
private boolean hasRevisedFinalMarkFlag;
}
......@@ -12,6 +12,7 @@ public class ProcessedResultDto {
private boolean hasInternalMarks;
private boolean hasFinalMarks;
private boolean hasRevisedFinalMarks;
private boolean hasPublished;
private String instituteName;
private Long instituteId;
private String course;
......
......@@ -4,6 +4,7 @@ import com.tarento.upsmf.examsAndAdmissions.enums.ResultStatus;
import lombok.*;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
@Getter
......@@ -16,5 +17,6 @@ public class StudentResultDTO {
private LocalDate dateOfBirth;
private String courseName;
private String courseYear;
private Date publishedDate;
private List<ExamDetailsDTO> examDetails;
}
......@@ -21,6 +21,8 @@ import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
......@@ -391,10 +393,12 @@ public class StudentResultService {
public ResponseDto publishResultsForCourseWithinCycle(Long courseId, Long examCycleId) {
ResponseDto response = new ResponseDto(Constants.API_PUBLISH_RESULTS_FOR_COURSE_WITHIN_CYCLE);
List<StudentResult> resultsForCourse = studentResultRepository.findByCourse_IdAndExam_ExamCycleIdAndPublished(courseId, examCycleId, false);
LocalDateTime localDateTime = LocalDateTime.now();
Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
if (!resultsForCourse.isEmpty()) {
for (StudentResult result : resultsForCourse) {
result.setPublished(true);
result.setPublishedDate(date);
}
studentResultRepository.saveAll(resultsForCourse);
response.put(Constants.MESSAGE, "Successfully published results.");
......@@ -445,6 +449,7 @@ public class StudentResultService {
Student student = studentRepository.findByEnrollmentNumber(firstResult.getEnrollmentNumber()).orElseThrow();
// dto.setDateOfBirth(firstResult.getStudent().getDateOfBirth());
dto.setDateOfBirth(student.getDateOfBirth());
dto.setPublishedDate(firstResult.getPublishedDate());
if (firstResult.getExamCycle_name() != null) {
ExamCycle examCycle = examCycleRepository.findByExamCycleName(firstResult.getExamCycle_name());
if (examCycle.getCourse() != null) {
......@@ -466,6 +471,7 @@ public class StudentResultService {
Long examCycleId = examCycleRepository.getIdByExamCycleName(studentResult.getExamCycle_name());
Long examId = examRepository.getIdByExamName(studentResult.getExam_name(),examCycleId);
examDto.setExamId(examId);
examDto.setHasRevisedFinalMarkFlag(studentResult.isRevisedFinalMarkFlag());
return examDto;
})
.collect(Collectors.toList());
......@@ -799,6 +805,7 @@ public class StudentResultService {
instituteResult.setHasInternalMarks(result.isInternalMarkFlag());
instituteResult.setHasFinalMarks(result.isFinalMarkFlag());
instituteResult.setHasRevisedFinalMarks(result.isRevisedFinalMarkFlag());
instituteResult.setHasPublished(result.isPublished());
}
return processedResults;
}
......
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