Exemple #1
0
  /**
   * This method compute the raw mark of the audit. Here is the algorithm formula :
   * passed/(passed+failed)
   *
   * @param wrStatistics
   * @return
   */
  public WebResourceStatistics computeRawMark(WebResourceStatistics wrStatistics) {
    float passed = wrStatistics.getNbOfPassed();
    // page on error, mark set to -1
    if (passed == -1) {
      wrStatistics.setRawMark(Float.valueOf(-1));
      return wrStatistics;
    }
    BigDecimal weightedPassed = wrStatistics.getWeightedPassed();
    BigDecimal weightedFailed = wrStatistics.getWeightedFailed();
    if ((weightedFailed.equals(BigDecimal.ZERO) || weightedFailed.equals(ZERO))
        && (weightedPassed.equals(BigDecimal.ZERO) || weightedPassed.equals(ZERO))) {
      wrStatistics.setRawMark(Float.valueOf(0));
      return wrStatistics;
    }

    float result =
        weightedPassed
                .divide(weightedPassed.add(weightedFailed), 4, RoundingMode.HALF_UP)
                .floatValue()
            * 100f;
    wrStatistics.setRawMark(result);
    return wrStatistics;
  }
Exemple #2
0
 /**
  * This method compute the mark of the audit. Here is the algorithm formula : ((1-ratioNMI) *
  * passed/(passed+failed) + ratioNMI * needMoreInfo/(passed+failed+needMoreInfo)) *100f where
  * ratioNMI = needMoreInfo / (passed+failed+needMoreInfo)
  *
  * @param wrStatistics
  * @return
  */
 public WebResourceStatistics computeMark(WebResourceStatistics wrStatistics) {
   float passed = wrStatistics.getNbOfPassed();
   // page on error, mark set to -1
   if (passed == -1) {
     wrStatistics.setRawMark(Float.valueOf(-1));
     return wrStatistics;
   }
   float failed = wrStatistics.getNbOfFailed();
   float needMoreInfo = wrStatistics.getNbOfNmi();
   if (failed == 0 && passed == 0) {
     wrStatistics.setMark(Float.valueOf(0));
     return wrStatistics;
   }
   float ratioNMI = needMoreInfo / (passed + failed + needMoreInfo);
   float result =
       ((1 - ratioNMI) * passed / (passed + failed)
               + ratioNMI * needMoreInfo / (passed + failed + needMoreInfo))
           * 100f;
   wrStatistics.setMark(result);
   return wrStatistics;
 }