package dendrarium.portal.stats;

import dendrarium.core.entities.User;

/**
 *
 * @author Tomasz Badowski
 */
public class DendrologStatsData {
    /*    @Factory(value = "myDone")
    @Observer("tbpchangestate")
    public void getMyDone(){
    this.myDone = (Long) session.getNamedQuery("myDoneAnswersNumber")
    .setParameter("user", user).uniqueResult();
    }

    @Factory(value = "myAll")
    @Observer("tbpchangestate")
    public void getMyAll(){
    this.myAll = (Long) session.getNamedQuery("myAnswersNumber")
    .setParameter("user", user).uniqueResult();
    }
     */

    private User user;

/*    String myAllAnsStr = "przydzielone";
    String myAllDoneAnsStr = "wszystkie wykonane";
    String myFullStr;
    String mySpecialStr;
    String myCollisionsStr;
*/
    private Long myAllAnsNum;

    private Long myAllDoneAnsNum;

    private Long myFullNum;

    private Long mySpecialNum;

    private Long myCollisionsNum;

    private Long myAllNeedConfNum;


    private Long nieprzydzielone;

    private long myNotAccepted;

    private long myAgreements;

    private long myNoTree;

    private long myRejected;

    private long mySolved;

    private long myRight;


    /*  Long onlyMineDoneNum;
     */

    public DendrologStatsData(User user) {
        this.user = user;
    }

    /**
     * @return the myAllDoneAnsNum
     */
    public Long getMyAllDoneAnsNum() {
        return myAllDoneAnsNum;
    }

    /**
     * @return the myFullNum
     */
    public Long getMyFullNum() {
        return myFullNum;
    }

    /**
     * @return the mySpecialNum
     */
    public Long getMySpecialNum() {
        return mySpecialNum;
    }

    /**
     * @return the myCollisionsNum
     */
    public Long getMyCollisionsNum() {
        return myCollisionsNum;
    }

    /**
     * @return the myAllAnsNum
     */
    public Long getMyAllAnsNum() {
        return myAllAnsNum;
    }

    /**
     * @param myAllAnsNum the myAllAnsNum to set
     */
    public void setMyAllAnsNum(Long myAllAnsNum) {
        this.myAllAnsNum = myAllAnsNum;
    }

    /**
     * @param myAllDoneAnsNum the myAllDoneAnsNum to set
     */
    public void setMyAllDoneAnsNum(Long myAllDoneAnsNum) {
        this.myAllDoneAnsNum = myAllDoneAnsNum;
    }

    /**
     * @param myFullNum the myFullNum to set
     */
    public void setMyFullNum(Long myFullNum) {
        this.myFullNum = myFullNum;
    }

    /**
     * @param mySpecialNum the mySpecialNum to set
     */
    public void setMySpecialNum(Long mySpecialNum) {
        this.mySpecialNum = mySpecialNum;
    }

    /**
     * @param myCollisionsNum the myCollisionsNum to set
     */
    public void setMyCollisionsNum(Long myCollisionsNum) {
        this.myCollisionsNum = myCollisionsNum;
    }

    /**
     * @return the user
     */
    public User getUser() {
        return user;
    }

    public Long getMyAllNeedConfNum() {
        return myAllNeedConfNum;
    }

    public void setMyAllNeedConfNum(Long myAllNeedConfNum) {
        this.myAllNeedConfNum = myAllNeedConfNum;
    }

    public Long getNieprzydzielone() {
        return nieprzydzielone;
    }

    public void setNieprzydzielone(Long nieprzydzielone) {
        this.nieprzydzielone = nieprzydzielone;
    }

    public Long getMyNotAccepted() {
        return myNotAccepted;
    }

    public Long getMyAgreements() {
        return myAgreements;
    }

    public Long getMyNoTree() {
        return myNoTree;
    }

    public Long getMyRejected() {
        return myRejected;
    }

    public Long getMySolved() {
        return mySolved;
    }

    public Long getMyRight() {
        return myRight;
    }

    public void setMyNotAccepted(long l) {
        this.myNotAccepted = l;
    }

    public void setMyAgreements(long l) {
        this.myAgreements = l;
    }

    public void setMyNoTree(long l) {
        this.myNoTree = l;
    }

    public void setMyRejected(long l) {
        this.myRejected = l;
    }

    public void setMySolved(long l) {
        this.mySolved = l;
    }

    public void setMyRight(long l) {
        this.myRight = l;
    }

    public Double getCollisionRatio() {
        Double ratio = 1.0*myCollisionsNum/myAllDoneAnsNum;
        return (double) (int) ((ratio+0.005)*100.0)/100.0;
    }

    public Double getRightRatio() {
        Double ratio = 1.0*myRight/mySolved;
        return ratio.isNaN() ? ratio : (double) (int) ((ratio+0.005)*100.0)/100.0;
    }
}