Merge branch 'Be/Registartion' into 'backend'
[Back-End] Be/registartion See merge request s11-webmobile1-sub2/S11P12A701!120
This commit is contained in:
commit
8dafe75cf1
@ -36,7 +36,7 @@ public class RegistrationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/{registrationId}")
|
@PutMapping("/{registrationId}")
|
||||||
public ResponseEntity<?> acceptRigistration(@RequestHeader("Authorization") String accessToken, @PathVariable long registrationId) {
|
public ResponseEntity<?> acceptRegistration(@RequestHeader("Authorization") String accessToken, @PathVariable long registrationId) {
|
||||||
Long userId = Long.parseLong(jwtUtil.getUserId(accessToken));
|
Long userId = Long.parseLong(jwtUtil.getUserId(accessToken));
|
||||||
|
|
||||||
if (!registrationService.acceptRegistration(userId, registrationId)) {
|
if (!registrationService.acceptRegistration(userId, registrationId)) {
|
||||||
@ -47,7 +47,7 @@ public class RegistrationController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/{registrationId}")
|
@DeleteMapping("/{registrationId}")
|
||||||
public ResponseEntity<?> deleteRigistration(@RequestHeader("Authorization") String accessToken, @PathVariable long registrationId) {
|
public ResponseEntity<?> deleteRegistration(@RequestHeader("Authorization") String accessToken, @PathVariable long registrationId) {
|
||||||
Long userId = Long.parseLong(jwtUtil.getUserId(accessToken));
|
Long userId = Long.parseLong(jwtUtil.getUserId(accessToken));
|
||||||
|
|
||||||
if (!registrationService.deleteRegistration(userId, registrationId)) {
|
if (!registrationService.deleteRegistration(userId, registrationId)) {
|
||||||
|
@ -18,6 +18,6 @@ public class QuizDto {
|
|||||||
private String image;
|
private String image;
|
||||||
private String answer;
|
private String answer;
|
||||||
private String userAnswer;
|
private String userAnswer;
|
||||||
private boolean isCollect;
|
private boolean isCorrect;
|
||||||
private List<ChoiceDto> choices;
|
private List<ChoiceDto> choices;
|
||||||
}
|
}
|
||||||
|
@ -54,17 +54,17 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
for (int idx = 0; idx < answerInputList.size(); idx++) {
|
for (int idx = 0; idx < answerInputList.size(); idx++) {
|
||||||
Quiz quiz = quizList.get(idx);
|
Quiz quiz = quizList.get(idx);
|
||||||
String inputAnswer = answerInputList.get(idx);
|
String inputAnswer = answerInputList.get(idx);
|
||||||
boolean isCollect;
|
boolean isCorrect;
|
||||||
Answer answer;
|
Answer answer;
|
||||||
if (quiz.getAnswer().equals(inputAnswer)) {
|
if (quiz.getAnswer().equals(inputAnswer)) {
|
||||||
correctCount++;
|
correctCount++;
|
||||||
isCollect = true;
|
isCorrect = true;
|
||||||
} else {
|
} else {
|
||||||
isCollect = false;
|
isCorrect = false;
|
||||||
}
|
}
|
||||||
answer = Answer.builder()
|
answer = Answer.builder()
|
||||||
.userAnswer(inputAnswer)
|
.userAnswer(inputAnswer)
|
||||||
.isCorrect(isCollect)
|
.isCorrect(isCorrect)
|
||||||
.report(report)
|
.report(report)
|
||||||
.quiz(quiz)
|
.quiz(quiz)
|
||||||
.build();
|
.build();
|
||||||
@ -106,7 +106,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
.question(quiz.getQuestion())
|
.question(quiz.getQuestion())
|
||||||
.answer(quiz.getAnswer())
|
.answer(quiz.getAnswer())
|
||||||
.userAnswer(answer.getUserAnswer())
|
.userAnswer(answer.getUserAnswer())
|
||||||
.isCollect(answer.isCorrect())
|
.isCorrect(answer.isCorrect())
|
||||||
.choices(choiceDtos)
|
.choices(choiceDtos)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user