Exemple #1
0
  private double calculateScorePart(int i, boolean enableLogging) {
    double score = 0.0;
    double partWeight, scaledQCount, avgLevel, scaledCorrectRatio;
    /** Calculate the normalized Number of words in current part */
    partWeight = QQUtils.PartWeight100[i] / 100;
    avgLevel = QParts.get(i).getAvgLevel();
    scaledQCount =
        QQUtils.sCurve(QParts.get(i).getNumCorrect(), QQUtils.Juz2SaturationQCount * partWeight);
    scaledQCount += 1;
    scaledCorrectRatio = QQUtils.sCurve(QParts.get(i).getCorrectRatio(), 1);

    score = 100 * partWeight * avgLevel * scaledQCount * scaledCorrectRatio;
    if (QQUtils.QQDebug == 1 && QParts.get(i).getNumCorrect() > 0 && enableLogging)
      Log.d(
          "["
              + i
              + "] S= "
              + new DecimalFormat("##.##")
                  .format(100 * partWeight * avgLevel * scaledQCount * scaledCorrectRatio)
              + "::pW="
              + new DecimalFormat("##.##").format(partWeight)
              + " av="
              + new DecimalFormat("##.##").format(avgLevel)
              + " sC="
              + new DecimalFormat("##.##").format(scaledQCount)
              + " sR="
              + new DecimalFormat("##.##").format(scaledCorrectRatio));
    return score;
  }
Exemple #2
0
  public CharSequence getDownScore(int CurrentPart) {
    double currentPartScore, currentPartScoreDown;
    double partWeight, avgLevel, scaledQCount, scaledCorrectRatio;
    int numCorrect, numQuestions, downScore;

    /**
     * Find the difference between the current and the to-be-decremented score The difference comes
     * from the current part only. The current is calculated normally, while the DOWN is calculated
     * manually as below
     */
    currentPartScore = calculateScorePart(CurrentPart, false);

    /** Calculate the normalized Number of words in current part + UP */
    numCorrect = QParts.get(CurrentPart).getNumCorrect();
    numQuestions = QParts.get(CurrentPart).getNumQuestions();
    partWeight = QQUtils.PartWeight100[CurrentPart] / 100;

    avgLevel = QParts.get(CurrentPart).getAvgLevel();
    scaledQCount =
        QQUtils.sCurve(
            QParts.get(CurrentPart).getNumCorrect(), QQUtils.Juz2SaturationQCount * partWeight);
    scaledQCount += 1;
    scaledCorrectRatio = QQUtils.sCurve(((float) numCorrect) / ((float) numQuestions + 1), 1);

    currentPartScoreDown = 100 * partWeight * avgLevel * scaledQCount * scaledCorrectRatio;
    downScore = (int) Math.round(currentPartScore - currentPartScoreDown);
    if (QQUtils.QQDebug == 1 && downScore == 0) {
      Log.d(
          "[0Down] Sd= "
              + new DecimalFormat("##.##")
                  .format(100 * partWeight * avgLevel * scaledQCount * scaledCorrectRatio)
              + "::pW="
              + new DecimalFormat("##.##").format(partWeight)
              + " av="
              + new DecimalFormat("##.##").format(avgLevel)
              + " sC="
              + new DecimalFormat("##.##").format(scaledQCount)
              + " sR="
              + new DecimalFormat("##.##").format(scaledCorrectRatio));
    }
    return String.valueOf(downScore);
  }