File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Horizon/Horizon/Sources/Features/Learn/Scores/Domain Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 18
18
19
19
import Combine
20
20
import Core
21
+ import Foundation
21
22
22
23
protocol ScoresInteractor {
23
24
var courseID : String { get }
@@ -103,8 +104,8 @@ final class ScoresInteractorLive: ScoresInteractor {
103
104
104
105
private func scoreGradeString( enrollment: ScoresCourseEnrollment ) -> String ? {
105
106
var scoreString : String ?
106
- if let score = enrollment . score ,
107
- let formattedScore = GradeFormatter . numberFormatter . string (
107
+ let score = 36.52341
108
+ if let formattedScore = GradeFormatter . horizonNumberFormatter . string (
108
109
from: GradeFormatter . truncate ( score)
109
110
) {
110
111
scoreString = " \( formattedScore) % "
@@ -121,3 +122,14 @@ final class ScoresInteractorLive: ScoresInteractor {
121
122
return scoreGradesString. isEmpty ? nil : scoreGradesString
122
123
}
123
124
}
125
+
126
+ extension GradeFormatter {
127
+ public static let horizonNumberFormatter : NumberFormatter = {
128
+ let formatter = NumberFormatter ( )
129
+ formatter. locale = Locale . current
130
+ formatter. maximumFractionDigits = 0
131
+ formatter. minimumFractionDigits = 0
132
+ formatter. numberStyle = . decimal
133
+ return formatter
134
+ } ( )
135
+ }
You can’t perform that action at this time.
0 commit comments