Skip to content

Commit

Permalink
Add + or - in front of the percentage change value
Browse files Browse the repository at this point in the history
  • Loading branch information
atrinh0 committed Jan 15, 2021
1 parent 105b95f commit 8adca01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions covid19/covid19/ViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ class ViewModel: ObservableObject {
let deathsPercentageChange: Double = Double(abs(deathsDifference))/Double(priorWeekDeaths) * 100

weeklyLatestCases = "+\(weeklyCases.formattedWithSeparator)"
weeklyCasesChange = " (\(casesMinusOrPlus)\(abs(casesDifference).formattedWithSeparator), \(casesPercentageChange.rounded(toPlaces: 1))%)"
weeklyCasesChange = " (\(casesMinusOrPlus)\(abs(casesDifference).formattedWithSeparator), \(casesMinusOrPlus)\(casesPercentageChange.rounded(toPlaces: 1))%)"
weeklyLatestDeaths = "+\(weeklyDeaths.formattedWithSeparator)"
weeklyDeathsChange = " (\(deathsMinusOrPlus)\(abs(deathsDifference).formattedWithSeparator), \(deathsPercentageChange.rounded(toPlaces: 1))%)"
weeklyDeathsChange = " (\(deathsMinusOrPlus)\(abs(deathsDifference).formattedWithSeparator), \(casesMinusOrPlus)\(deathsPercentageChange.rounded(toPlaces: 1))%)"
}

let casesArray = data.map { Double($0.cases ?? 0) }
Expand Down

0 comments on commit 8adca01

Please sign in to comment.