Fixed odometer reading to update properly - #413
Conversation
mikaelacaron
left a comment
There was a problem hiding this comment.
Great work!! I have several comments that need resolved please. If you have any questions, you can comment directly on that thread, otherwise click the resolve button once you've addressed my comment. Once you fix everything, please click the re-review button
I'm getting an error in the console. Also a few comments of some stuff to fix please!
Attempting to initialize or set a @documentid property with a non-nil value: "docIDHere". The document ID is managed by Firestore and any initialized or set value will be ignored. The ID is automatically set when reading from Firestore.
| .onAppear { | ||
| Task { await viewModel.getVehicles() } | ||
| } |
There was a problem hiding this comment.
This should use .task instead
|
|
||
| let firebaseService: FirebaseServiceProtocol | ||
|
|
||
There was a problem hiding this comment.
remove some of these line breaks / tabs that were added on accident
| vin: VIN, | ||
| licensePlateNumber: licensePlateNumber) | ||
| addTapped(vehicle) | ||
| print("VEHICLE HAS BEEN ADDED") |
There was a problem hiding this comment.
remove this please! cause it's just debugging
| if let uid = userUID { | ||
| var readingToUpdate = reading | ||
| readingToUpdate.userID = uid |
There was a problem hiding this comment.
something similar is happening in FirebaseService.updateReading() should that be removed?
There was a problem hiding this comment.
That's the question I have.
Why a separate FirebaseService class is used for only OdometerReading because it can be done in OdometerViewModel itself just like it's done for the DshboardViewModel
There was a problem hiding this comment.
It's to be able to unit test OdometerViewModel
Eventually both OdometerViewModel and DashboardViewModel will use a FirebaseService
What it Does
userIDwhen updating the odometer record.How I Tested
Notes
Screenshot