total time now works as expected and tried (but failed) to add conversion between miles and kilometers for pace

This commit is contained in:
Isaac Greene 2022-04-11 21:18:21 -04:00
parent 8cb3960507
commit addcb49778
3 changed files with 90 additions and 39 deletions

View file

@ -11,15 +11,34 @@ struct April2022: View {
var body: some View {
ScrollView {
//2022-04-11
HStack {
VStack (alignment: .leading) {
Text("2022-04-11")
.font(.title2)
Text("Version Prerelease Build LVSXT10k\n")
.font(.footnote)
Text("\u{2022} Fixed total time display so now 300 seconds properly wraps to 5 minutes and minutes now also wrap when seconds equates to an amount that equals more than 60 minutes\n\u{2022} Forced all text in change log to left side of screen")
}
Spacer()
}
.padding(30)
//2022-04-10
HStack {
VStack (alignment: .leading) {
Text("2022-04-10")
.font(.title2)
Text("Version Prerelease Build LVSXT10l\n")
Text("Version Prerelease Build LVSXT10m\n")
.font(.footnote)
Text("\u{2022} Added known issues view.\n\t\u{2022} Might add this to the change log navigation at the bottom in the future")
Text("\u{2022} Added known issues view\n\t\u{2022} Might add this to the change log navigation at the bottom in the future\n\u{2022} Reverted to a different commit in Git so that the app can be used")
}
Spacer()
}
.padding(30)
//2022-04-09
HStack {
VStack (alignment: .leading) {
Text("2022-04-09:")
.font(.title2)
@ -27,9 +46,12 @@ struct April2022: View {
.font(.footnote)
Text("\u{2022} Fixed the math with seconds so now you can actually use them! YEAH BABY!\n\u{2022} Rounded pace so that you don't get values like 4.999999999999996 minutes per km\n\t\u{2022} Working on getting the seconds to change into minutes like 340 seconds will show as 5 minutes 40 seconds or \"0:05:40\"\n\u{2022} Removed warning about not using seconds (because they work now!)\n\u{2022} Got math color right. Issue was I had my colors switched so it showed black text in dark mode, and white text in light mode.\n\u{2022} Fixed distance between time boxes\n\u{2022} Removed text about not using seconds greater than 59 in text field\n\u{2022} Properly implemented tab view so that each view gets ONE (1) tab\n\u{2022} Added Git which I should've done long ago\n\u{2022} Tweaked various visual elements. For some reason, SF Symbols doesn't have a calculator??? So instead I'm using \"candybarphone\" but \"building\" looked good, too\n\u{2022} Got overflow of minutes working so now 100 minutes will show as 1 hour 40 minutes.\n\t\u{2022} Seconds overflow does not work (see known issues)")
}
Spacer()
}
.padding(30)
//2022-04-08
HStack {
VStack (alignment: .leading) {
Text("2022-04-08:")
.font(.title2)
@ -37,9 +59,12 @@ struct April2022: View {
.font(.footnote)
Text("\u{2022} Added bullet points to change log\n\u{2022} Changed text in \"Help\" section about using seconds (ended up not working)\n\u{2022} Tried unsuccessfully to dynamically change the color of the pace formula whether in dark or light mode\n\u{2022} Temporarily removed change log in Build t\n\u{2022} Fixed positioning of minutes and seconds text boxes\n\u{2022} Total time now shows correct minute/hour time (minutes and hours are no longer equal)\n\t\u{2022} Seconds still don't work properly")
}
Spacer()
}
.padding(30)
//2022-04-05
HStack {
VStack (alignment: .leading) {
Text("2022-04-05:")
.font(.title2)
@ -47,9 +72,12 @@ struct April2022: View {
.font(.footnote)
Text("\u{2022} Reformatted change log to include better navigation and clearer notice of changes")
}
Spacer()
}
.padding(30)
//2022-04-03
HStack {
VStack (alignment: .leading) {
Text("2022-04-03:")
.font(.title2)
@ -57,6 +85,8 @@ struct April2022: View {
.font(.footnote)
Text("\u{2022} Fixed math\n\u{2022} Implemented change log view\n\u{2022} Restructured code so it gave fewer errors\n\u{2022} Added correct pace data\n\t\u{2022} At this time, the seconds functionality is entirely broken\n\u{2022} Implemented total time view\n\t\u{2022} For some reason, the view for the minutes automatically fills in for the hours as well")
}
Spacer()
}
.padding(30)
}
}

View file

@ -67,26 +67,46 @@ struct PaceResults: View {
@Binding var distance: String
var body: some View {
let timeMinutesDouble = Double(timeMinutes) ?? 0.0
let timeHours = String(Int(timeMinutesDouble / 60))
//var pacePerUnit = 0.0
//var notSelectedSystem = ""
let convertedSeconds = (Double(timeSeconds) ?? 0) * (1+(2/3))
let timeSecondsInt = Int(timeSeconds) ?? 0
let timeSecondsUnderSixty = (timeSecondsInt > 60 ? Int(timeSecondsInt / 60) : timeSecondsInt)
let timeSecondsUnderSixty = (timeSecondsInt % 60)
let timeMinutesInt = (Int(timeMinutes) ?? 0) + (Int(timeSecondsUnderSixty))
let timeMinutesUnderSixty = timeMinutesInt - ((Int(timeHours) ?? 0) * 60)
let timeSecondsToMinutes = (timeSecondsInt - timeSecondsUnderSixty) / 60
let leadingZeros = String(format: "%02d:%02d", timeMinutesUnderSixty, timeSecondsInt)
let timeMinutesDouble = Double(timeMinutes) ?? 0.0
let timeMinutesInt = (Int(timeMinutes) ?? 0) + (timeSecondsToMinutes)
let timeMinutesUnderSixty = timeMinutesInt % 60
let timeMinutesToHours = (timeMinutesInt - timeMinutesUnderSixty) / 60
let leadingZeros = String(format: "%02d:%02d", timeMinutesUnderSixty, timeSecondsUnderSixty)
let actualTime = timeMinutesDouble + (convertedSeconds / 100)
let pace = actualTime / (Double(distance) ?? 1)
let paceString = String(format: "%.2f", pace)
/*
if selectedSystem == "km" {
pacePerUnit = actualTime / (distance * 1.609344)
notSelectedSystem = "mi"
}
else {
pacePerUnit = actualTime / (distance * 0.6213711922)
notSelectedSystem = "km"
}
let pacePerUnitString = String(format: "%.02f", pacePerUnit)
*/
VStack {
Text("Distance: \(distance)\(selectedSystem)")
Text("Total time: \(timeHours):\(leadingZeros)")
Text("Total time: \(timeMinutesToHours):\(leadingZeros)")
Text("\(paceString) minutes per \(selectedSystem)")
//Text("\(pacePerUnitString) minutes per \(notSelectedSystem)")
}
}
}

View file

@ -117,7 +117,8 @@ struct problemView: View {
.font(.largeTitle)
.bold()
.padding(.top, 40)
Text("\n\u{2022} You can not dismiss the keyboard\n\t\u{2022} This hides the tab bar at the bottom\n\u{2022} Visually displayed seconds and total time are incorrect\n\t\u{2022} This DOES NOT affect pace. That is still correct.")
Text("\n\u{2022} You can not dismiss the keyboard\n\t\u{2022} This hides the tab bar at the bottom so you can't navigate the app\n\u{2022} Entering a number that is too large (20 digits) into the minutes field will cause the app to crash")
.padding()
}
}
}