Skip to content

Commit f6d19e9

Browse files
committed
Scoreboard refactoring.
1 parent 38be10a commit f6d19e9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Moblin/VideoEffects/Scoreboard/ScoreboardEffect.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ private struct ModularScoreboardView: View {
185185

186186
private func calculateMaxHistory(config: RemoteControlScoreboardMatchConfig) -> Int {
187187
var maxHistory = 0
188-
for i in 1 ... 5 {
189-
let homeHas = getHistoryVal(team: config.team1, i: i) != nil
190-
let awayHas = getHistoryVal(team: config.team2, i: i) != nil
188+
for indexPlusOne in 1 ... 5 {
189+
let homeHas = getHistoricScore(team: config.team1, indexPlusOne: indexPlusOne) != nil
190+
let awayHas = getHistoricScore(team: config.team2, indexPlusOne: indexPlusOne) != nil
191191
if homeHas || awayHas {
192-
maxHistory = i
192+
maxHistory = indexPlusOne
193193
}
194194
}
195195
return maxHistory
@@ -279,8 +279,8 @@ private struct ModularScoreboardView: View {
279279
.frame(height: height)
280280
if histCount > 0 {
281281
ForEach(1 ... histCount, id: \.self) { i in
282-
let val = self.getHistoryVal(team: team, i: i) ?? ""
283-
let oppVal = self.getHistoryVal(team: otherTeam, i: i) ?? ""
282+
let val = self.getHistoricScore(team: team, indexPlusOne: i) ?? ""
283+
let oppVal = self.getHistoricScore(team: otherTeam, indexPlusOne: i) ?? ""
284284
let valInt = Int(val) ?? -1
285285
let oppInt = Int(oppVal) ?? -1
286286
let weight: Font.Weight = (i < currentPeriod && valInt > oppInt && valInt >= 0)
@@ -331,8 +331,8 @@ private struct ModularScoreboardView: View {
331331
.foregroundStyle(textColor)
332332
}
333333

334-
private func getHistoryVal(team: RemoteControlScoreboardTeam, i: Int) -> String? {
335-
switch i {
334+
private func getHistoricScore(team: RemoteControlScoreboardTeam, indexPlusOne: Int) -> String? {
335+
switch indexPlusOne {
336336
case 1:
337337
return team.secondaryScore1
338338
case 2:

0 commit comments

Comments
 (0)