Skip to content

Commit 3a7a3c7

Browse files
committed
CRs
1 parent 2239f4c commit 3a7a3c7

File tree

4 files changed

+37
-9
lines changed

4 files changed

+37
-9
lines changed

apps/parent/src/main/java/com/instructure/parentapp/di/feature/GradesModule.kt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ package com.instructure.parentapp.di.feature
2020
import com.instructure.canvasapi2.apis.AssignmentAPI
2121
import com.instructure.canvasapi2.apis.CourseAPI
2222
import com.instructure.canvasapi2.managers.graphql.CustomGradeStatusesManager
23-
import com.instructure.canvasapi2.models.Course
2423
import com.instructure.pandautils.features.grades.GradesRepository
2524
import com.instructure.pandautils.features.grades.GradesViewModelBehavior
2625
import com.instructure.parentapp.features.grades.ParentGradesRepository
26+
import com.instructure.parentapp.features.grades.ParentGradesViewModelBehavior
2727
import com.instructure.parentapp.util.ParentPrefs
2828
import dagger.Module
2929
import dagger.Provides
@@ -46,10 +46,6 @@ class GradesModule {
4646

4747
@Provides
4848
fun provideGradesViewModelBehavior(): GradesViewModelBehavior {
49-
return object : GradesViewModelBehavior {
50-
override fun isWhatIfGradingEnabled(course: Course): Boolean {
51-
return course.settings?.restrictQuantitativeData != true
52-
}
53-
}
49+
return ParentGradesViewModelBehavior()
5450
}
5551
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (C) 2025 - present Instructure, Inc.
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, version 3 of the License.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*
16+
*/
17+
18+
package com.instructure.parentapp.features.grades
19+
20+
import com.instructure.canvasapi2.models.Course
21+
import com.instructure.pandautils.features.grades.GradesViewModelBehavior
22+
23+
class ParentGradesViewModelBehavior : GradesViewModelBehavior {
24+
25+
override fun isWhatIfGradingEnabled(course: Course): Boolean {
26+
return false
27+
}
28+
}

libs/pandares/src/main/res/values/strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,14 +1941,14 @@
19411941
<string name="gradeLockedContentDescription">Grade locked</string>
19421942
<string name="gradesRefreshFailed">Failed to refresh grades</string>
19431943
<string name="showWhatIfScore">Show What-if Score</string>
1944-
<string name="editWhatIfScore">Edit what-if score</string>
1944+
<string name="editWhatIfScore">Edit what-if Score</string>
19451945
<string name="editWhatIfScoreTitle">Edit What-if Score</string>
19461946
<string name="whatIfScoreLabel">What-if</string>
19471947
<string name="whatIfScoreCurrentGraded">Score %1$.0f out of %2$.0f</string>
19481948
<string name="whatIfScoreCurrentUngraded">Not graded, max score %.0f</string>
19491949
<string name="whatIfScoreDisplay">What-if: %s</string>
19501950
<string name="gradesBasedOnGradedAndWhatIf">Based on graded assignments, and What-if Score</string>
1951-
<string name="clearWhatIfScore">Clear what-if score</string>
1951+
<string name="clearWhatIfScore">Clear what-if Score</string>
19521952
<string name="chooseACourseToMessage">Choose a course to message</string>
19531953
<string name="regardingHiddenMessage">Regarding: %1$s, %2$s</string>
19541954
<string name="regardingHiddenMessageWithAssignmentPrefix">Regarding: %1$s, Assignment - %2$s</string>

libs/pandautils/src/main/java/com/instructure/pandautils/features/grades/GradesScreen.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ import androidx.compose.ui.tooling.preview.Preview
114114
import androidx.compose.ui.unit.dp
115115
import androidx.compose.ui.unit.sp
116116
import com.instructure.canvasapi2.utils.ContextKeeper
117+
import com.instructure.canvasapi2.utils.NumberHelper
117118
import com.instructure.pandautils.R
118119
import com.instructure.pandautils.compose.CanvasTheme
119120
import com.instructure.pandautils.compose.NoRippleInteractionSource
@@ -133,6 +134,7 @@ import com.instructure.pandautils.features.grades.gradepreferences.GradePreferen
133134
import com.instructure.pandautils.utils.DisplayGrade
134135
import com.instructure.pandautils.utils.announceAccessibilityText
135136
import com.instructure.pandautils.utils.drawableId
137+
import com.instructure.pandautils.utils.orDefault
136138
import kotlinx.coroutines.android.awaitFrame
137139
import kotlinx.coroutines.launch
138140

@@ -1021,7 +1023,9 @@ fun AssignmentItem(
10211023
)
10221024
.padding(horizontal = 4.dp)
10231025
) {
1024-
val whatIfScoreText = "${uiState.whatIfScore.toInt()}/${uiState.maxScore?.toInt()}"
1026+
val whatIfScore = NumberHelper.formatDecimal(uiState.whatIfScore, 2, true)
1027+
val maxScore = NumberHelper.formatDecimal(uiState.maxScore.orDefault(), 2, true)
1028+
val whatIfScoreText = "$whatIfScore/$maxScore"
10251029
Text(
10261030
text = stringResource(
10271031
id = R.string.whatIfScoreDisplay,

0 commit comments

Comments
 (0)