Пример #1
0
  /**
   * Add register to ScoreRegister if this is an scored question
   *
   * @return List</Float> {num, den}
   */
  public List<Float> initScore(float idSurvey, String module) {
    if (!this.isScored()) {
      return null;
    }

    Float num = ScoreRegister.calcNum(this, idSurvey);
    // If the num is null the question is ignored
    if (num == null) return null;
    Float denum = ScoreRegister.calcDenum(this, idSurvey);
    ScoreRegister.addRecord(this, num, denum, idSurvey, module);
    return Arrays.asList(num, denum);
  }
Пример #2
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View rowView = getInflater().inflate(R.layout.composite_scores_record, parent, false);

    CompositeScore item = (CompositeScore) getItem(position);

    ((CustomTextView) rowView.findViewById(R.id.code)).setText(item.getHierarchical_code());
    ((CustomTextView) rowView.findViewById(R.id.label)).setText(item.getLabel());

    Float compositeScoreValue = ScoreRegister.getCompositeScore(item, idSurvey, module);

    if (compositeScoreValue == null)
      ((CustomTextView) rowView.findViewById(R.id.score))
          .setText(getContext().getString(R.string.number_zero));
    else
      ((CustomTextView) rowView.findViewById(R.id.score))
          .setText(AUtils.round(compositeScoreValue));

    rowView.setBackgroundResource(LayoutUtils.calculateBackgrounds(position));

    return rowView;
  }