Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
2.2 kB
2
Indexable
Never
package pt.ulisboa.tecnico.socialsoftware.tutor.teacherdashboard.domain;

import pt.ulisboa.tecnico.socialsoftware.tutor.execution.domain.CourseExecution;
import pt.ulisboa.tecnico.socialsoftware.tutor.impexp.domain.DomainEntity;
import pt.ulisboa.tecnico.socialsoftware.tutor.impexp.domain.Visitor; //?? esse é preciso
import pt.ulisboa.tecnico.socialsoftware.tutor.user.domain.Teacher;

import javax.persistence.*;


@Entity
public class QuestionStats implements DomainEntity {

    private int numAvailable;

    private int answeredQuestionUnique;

    private float averageQuestionsAnswered;

    @OneToOne
    private CourseExecution courseExecution;

    @ManyToOne
    private TeacherDashboard teacherDashboard;

    public QuestionStats() {
    }

    //getters and setters
    public int getNumAvailable() { return courseExecution.getNumberOfQuestions(); }
    public void setNumAvailable(int numAvailable) {this.numAvailable = numAvailable; }

    public int getAnsweredQuestionUnique() { return answeredQuestionUnique; }
    public void setAnsweredQuestionUnique(int answeredQuestionUnique) {this.answeredQuestionUnique = answeredQuestionUnique; }

    public float getAverageQuestionsAnswered() { return averageQuestionsAnswered; }
    public void setAverageQuestionsAnswered(float averageQuestionsAnswered) {this.averageQuestionsAnswered = averageQuestionsAnswered; }

    public CourseExecution getCourseExecution() {
        return courseExecution;
    }

    public void setCourseExecution(CourseExecution courseExecution) {
        this.courseExecution = courseExecution;
    }

    public void update(){
        //TODO --- this.setNumAvailable(getNumAvailable());
    }

    public void accept(Visitor visitor) {
        // Only used for XML generation
    }

    @Override
    public String toString() {
        return "Dashboard{" +
                "numAvailable=" + numAvailable +
                ", answeredQuestionUnique=" + answeredQuestionUnique +
                ", averageQuestionsAnswered=" + averageQuestionsAnswered +
                ", courseExecution=" + courseExecution +
                '}';
    }

}