package cn.reghao.tnb.content.app.exam.model.vo;

import cn.reghao.jutil.jdk.converter.DateTimeConverter;
import cn.reghao.tnb.content.app.exam.model.po.Paper;
import cn.reghao.tnb.content.app.exam.model.po.PaperResult;
import lombok.Getter;

import java.util.List;

/**
 * @author reghao
 * @date 2024-08-24 20:02:44
 */
@Getter
public class ExamResult {
    private int resultId;
    private int examId;
    private String examName;
    private int paperScore;
    private long userId;
    private String examTime;
    private int objectiveScore;
    private int subjectiveScore;
    private int userScore;
    private List<QuestionResult> questionResults;

    public ExamResult(Paper paper, PaperResult paperResult, List<QuestionResult> questionResults) {
        this.resultId = paperResult.getId();
        this.examId = paper.getId();
        this.examName = paper.getName();
        this.paperScore = paper.getTotalScore();
        this.userId = 1;
        this.examTime = DateTimeConverter.format(paperResult.getExamTime());
        this.objectiveScore = paperResult.getObjectiveScore();
        this.subjectiveScore = paperResult.getSubjectiveScore();
        this.userScore = paperResult.getUserScore();
        this.questionResults = questionResults;
    }
}
