Remove Zachowanie from all count of subjects (#1447)

This commit is contained in:
Rafał Borcz 2021-08-24 19:51:08 +02:00 committed by GitHub
parent 2979d8b62a
commit a6a2bcff3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -59,6 +59,7 @@ class GradeSummaryAdapter @Inject constructor(
val context = binding.root.context val context = binding.root.context
val finalItemsCount = items.count { it.finalGrade.matches("[0-6][+-]?".toRegex()) } val finalItemsCount = items.count { it.finalGrade.matches("[0-6][+-]?".toRegex()) }
val calculatedItemsCount = items.count { value -> value.average != 0.0 } val calculatedItemsCount = items.count { value -> value.average != 0.0 }
val allItemsCount = items.count { !it.subject.equals("zachowanie", true) }
val finalAverage = items.calcAverage( val finalAverage = items.calcAverage(
preferencesRepository.gradePlusModifier, preferencesRepository.gradePlusModifier,
preferencesRepository.gradeMinusModifier preferencesRepository.gradeMinusModifier
@ -72,11 +73,15 @@ class GradeSummaryAdapter @Inject constructor(
gradeSummaryScrollableHeaderFinal.text = formatAverage(finalAverage) gradeSummaryScrollableHeaderFinal.text = formatAverage(finalAverage)
gradeSummaryScrollableHeaderCalculated.text = formatAverage(calculatedAverage) gradeSummaryScrollableHeaderCalculated.text = formatAverage(calculatedAverage)
gradeSummaryScrollableHeaderFinalSubjectCount.text = gradeSummaryScrollableHeaderFinalSubjectCount.text =
context.getString(R.string.grade_summary_from_subjects, finalItemsCount, items.size) context.getString(
R.string.grade_summary_from_subjects,
finalItemsCount,
allItemsCount
)
gradeSummaryScrollableHeaderCalculatedSubjectCount.text = context.getString( gradeSummaryScrollableHeaderCalculatedSubjectCount.text = context.getString(
R.string.grade_summary_from_subjects, R.string.grade_summary_from_subjects,
calculatedItemsCount, calculatedItemsCount,
items.size allItemsCount
) )
} }
} }

View File

@ -101,7 +101,7 @@
<string name="grade_summary_predicted_grade">Predicted grade</string> <string name="grade_summary_predicted_grade">Predicted grade</string>
<string name="grade_summary_calculated_average">Calculated average</string> <string name="grade_summary_calculated_average">Calculated average</string>
<string name="grade_summary_final_average">Final average</string> <string name="grade_summary_final_average">Final average</string>
<string name="grade_summary_from_subjects">From %1$d of %2$d subjects</string> <string name="grade_summary_from_subjects">from %1$d of %2$d subjects</string>
<string name="grade_menu_summary">Summary</string> <string name="grade_menu_summary">Summary</string>
<string name="grade_menu_statistics">Class</string> <string name="grade_menu_statistics">Class</string>
<string name="grade_menu_read">Mark as read</string> <string name="grade_menu_read">Mark as read</string>