Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Partial commit for new stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Eng committed May 21, 2013
1 parent 0c89056 commit 2553511
Showing 1 changed file with 71 additions and 63 deletions.
Expand Up @@ -54,11 +54,12 @@ public enum StatUnit
MESSAGE;
}

private long translated;
private long needReview;
private long untranslated;
private long fuzzy;
private long translated;
private long approved;
private long rejected;
private long accepted;

private long total;
private StatUnit unit;
private String locale;
Expand All @@ -73,26 +74,58 @@ public TranslationStatistics(TransUnitCount unitCount, String locale)
{
this.unit = StatUnit.MESSAGE;
this.locale = locale;
translated = unitCount.getApproved();
needReview = unitCount.getNeedReview();
untranslated = unitCount.getUntranslated();
rejected = unitCount.getRejected();
accepted = unitCount.getAccepted();
fuzzy = unitCount.getNeedReview();
// translated = unitCount.getApproved();
approved = unitCount.getApproved();
// rejected = unitCount.getRejected();

total = unitCount.getTotal();
}

public TranslationStatistics(TransUnitWords wordCount, String locale)
{
this.unit = StatUnit.WORD;
this.locale = locale;
translated = wordCount.getApproved();
needReview = wordCount.getNeedReview();

untranslated = wordCount.getUntranslated();
rejected = wordCount.getRejected();
accepted = wordCount.getAccepted();
fuzzy = wordCount.getNeedReview();
// translated = wordCount.getApproved();
approved = wordCount.getApproved();
// rejected = wordCount.getRejected();


total = wordCount.getTotal();
}

/**
* Number of untranslated elements.
*/
@XmlAttribute
public long getUntranslated()
{
return untranslated;
}

public void setUntranslated(long untranslated)
{
this.untranslated = untranslated;
}

/**
* Number of elements that need review (i.e. Fuzzy).
*/
@XmlAttribute
public long getFuzzy()
{
return fuzzy;
}

public void setFuzzy(long fuzzy)
{
this.fuzzy = fuzzy;
}

/**
* Number of translated elements.
*/
Expand All @@ -106,33 +139,30 @@ public void setTranslated(long translated)
{
this.translated = translated;
}

/**
* Number of elements that need review (i.e. Fuzzy).
*/
* Number of approved elements.
*/
@XmlAttribute
public long getNeedReview()
public long getApproved()
{
return needReview;
return approved;
}

public void setNeedReview(long needReview)
public void setApproved(long approved)
{
this.needReview = needReview;
this.approved = approved;
}

/**
* Number of untranslated elements.
*/

@XmlAttribute
public long getUntranslated()
public long getRejected()
{
return untranslated;
return rejected;
}

public void setUntranslated(long untranslated)
public void setRejected(long rejected)
{
this.untranslated = untranslated;
this.rejected = rejected;
}

/**
Expand Down Expand Up @@ -188,28 +218,6 @@ public void setLastTranslated(String lastTranslated)
this.lastTranslated = lastTranslated;
}

@XmlAttribute
public long getRejected()
{
return rejected;
}

public void setRejected(long rejected)
{
this.rejected = rejected;
}

@XmlAttribute
public long getAccepted()
{
return accepted;
}

public void setAccepted(long accepted)
{
this.accepted = accepted;
}

@XmlTransient
public int getPercentTranslated()
{
Expand All @@ -235,7 +243,7 @@ public int getPercentNeedReview()
}
else
{
double per = 100 * getNeedReview() / total;
double per = 100 * getFuzzy() / total;
return (int) Math.ceil(per);
}
}
Expand Down Expand Up @@ -269,10 +277,10 @@ public double getRemainingHours()
public void add(TranslationStatistics other)
{
this.translated += other.translated;
this.needReview += other.needReview;
// this.needReview += other.needReview;
this.untranslated += other.untranslated;
this.rejected += other.rejected;
this.accepted += other.accepted;
// this.accepted += other.accepted;
}

public void increment(ContentState state, long count)
Expand All @@ -292,13 +300,13 @@ public long get(ContentState state)
case Approved:
return translated;
case NeedReview:
return needReview;
return fuzzy;
case New:
return untranslated;
case Rejected:
return rejected;
case Accepted:
return accepted;
// case Rejected:
// return rejected;
// case Accepted:
// return accepted;
default:
throw new RuntimeException("not implemented for state " + state.name());
}
Expand All @@ -312,17 +320,17 @@ public void set(ContentState state, long value)
translated = value;
break;
case NeedReview:
needReview = value;
fuzzy = value;
break;
case New:
untranslated = value;
break;
case Rejected:
rejected = value;
break;
case Accepted:
accepted = value;
break;
// case Rejected:
// rejected = value;
// break;
// case Accepted:
// accepted = value;
// break;
default:
throw new RuntimeException("not implemented for state " + state.name());
}
Expand Down

0 comments on commit 2553511

Please sign in to comment.