Skip to content

Commit

Permalink
Merge pull request #89 from chrqls/dev
Browse files Browse the repository at this point in the history
[#14] Removing 'Highest Rating' + Reparing '% correct'
  • Loading branch information
Charles Quelos committed Dec 17, 2013
2 parents 1b5184a + 7dd1689 commit 1b7a769
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
20 changes: 10 additions & 10 deletions res/layout-large-land/students.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,16 @@
android:layout_marginTop="5dip"
android:layout_below="@+id/view_separator_above" />

<TextView
android:id="@+id/tv_top_scorers_rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/score"
android:textColor="@color/black"
android:textSize="16sp"
android:layout_marginLeft="10dip"
android:layout_marginTop="10dip"
android:layout_below="@+id/tv_top_scorers_top" />
<!-- <TextView -->
<!-- android:id="@+id/tv_top_scorers_rating" -->
<!-- android:layout_width="wrap_content" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:text="@string/score" -->
<!-- android:textColor="@color/black" -->
<!-- android:textSize="16sp" -->
<!-- android:layout_marginLeft="10dip" -->
<!-- android:layout_marginTop="10dip" -->
<!-- android:layout_below="@+id/tv_top_scorers_top" /> -->

<!-- <RatingBar -->
<!-- android:id="@+id/rb_ratingbar" -->
Expand Down
21 changes: 9 additions & 12 deletions src/main/java/org/smilec/smile/ui/fragment/StudentsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,11 @@ private String getPercentCompleted() {

float n = 0;

System.out.println("*****students.size()="+students.size());
System.out.println("**Number of students in session ="+students.size());

for(int i=0; i<students.size();i++) {

System.out.println("=====students.get(i).isSolved()="+students.get(i).isSolved());
System.out.println("**The student 'i' already solved the questions ="+students.get(i).isSolved());

n += students.get(i).isSolved() ? 1:0;
}
Expand Down Expand Up @@ -294,10 +294,9 @@ private String getPercentCorrect() {

nbQuestionsCorrect += answersOfStudent.get(q).equals(q.getAnswer()) ? 1:0;
}

// if the student has 70+% of correct answers, we count it
nbStudentOver70 += nbQuestionsCorrect*100/questions.size() >= 70 ? 1:0;
}
// if the student has 70+% of correct answers, we count it
nbStudentOver70 += nbQuestionsCorrect*100/questions.size() >= 70 ? 1:0;
}

float percent = !students.isEmpty()? (float) (nbStudentOver70/students.size())*100 : 0;
Expand All @@ -314,13 +313,8 @@ private void setTopScorersArea(Results results, Board board) {
R.id.tv_top_scorers_top);

String sBestScoredStudentNames = results.getBestScoredStudentNames();
JSONArray bestScoredStudentNames = new JSONArray(sBestScoredStudentNames == null ? ""
: sBestScoredStudentNames);
tvTopScorersTop.setText(getString(R.string.top_scorer) + ": "
+ bestScoredStudentNames.join(", ").replaceAll("\"", ""));

TextView tvTopScorersRating = (TextView) getActivity().findViewById(R.id.tv_top_scorers_rating);
tvTopScorersRating.setText(getString(R.string.rating) + ": " + results.getWinnerRating());
JSONArray bestScoredStudentNames = new JSONArray(sBestScoredStudentNames == null ? "" : sBestScoredStudentNames);
tvTopScorersTop.setText(getString(R.string.top_scorer) + ": " + bestScoredStudentNames.join(", ").replaceAll("\"", ""));

TextView tvPercentCompleted = (TextView) getActivity().findViewById(R.id.tv_percent_completed);
tvPercentCompleted.setText(this.getPercentCompleted());
Expand All @@ -329,6 +323,9 @@ private void setTopScorersArea(Results results, Board board) {
TextView tvPercentCorrect = (TextView) getActivity().findViewById(R.id.tv_percent_correct);
tvPercentCorrect.setText(this.getPercentCorrect());
tvPercentCorrect.setVisibility(View.VISIBLE);

//TextView tvTopScorersRating = (TextView) getActivity().findViewById(R.id.tv_top_scorers_rating);
//tvTopScorersRating.setText(getString(R.string.rating) + ": " + results.getWinnerRating());

// Seems useless >> issues 14
//final RatingBar rbRatingBar = (RatingBar) getActivity().findViewById(R.id.rb_ratingbar);
Expand Down

0 comments on commit 1b7a769

Please sign in to comment.