From 092d6e731b4e30e1615a45245dbfdda49b5dae1f Mon Sep 17 00:00:00 2001 From: alexfedsv Date: Mon, 20 May 2024 17:37:07 +0300 Subject: [PATCH] ids once more --- LiveRecipes/Modules/Creation/CreationModel.swift | 4 +++- LiveRecipes/Modules/Creation/Dish.swift | 3 +-- LiveRecipes/Modules/Creation/StepView.swift | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/LiveRecipes/Modules/Creation/CreationModel.swift b/LiveRecipes/Modules/Creation/CreationModel.swift index 6871b89..6eafdb6 100644 --- a/LiveRecipes/Modules/Creation/CreationModel.swift +++ b/LiveRecipes/Modules/Creation/CreationModel.swift @@ -17,6 +17,8 @@ final class CreationModel: ObservableObject, CreationModelProtocol { for dish in dishes { print("---") print("id: \(String(describing: dish.id))") + print("dish.id: \(String(describing: dish.id))") + print("dish.netId: \(String(describing: dish.netId))") print("title: \(dish.title)") print("description: \(dish.description)") print("timeToPrepare: \(dish.timeToPrepare)") @@ -29,7 +31,7 @@ final class CreationModel: ObservableObject, CreationModelProtocol { for step in dish.dishSteps { print("---") print("step.id: \(step.id)") - print("step.title: \(step.stepTime)") + print("step.stepTime: \(step.stepTime)") print("step.description: \(step.description)") print("step.photo: \(step.photo == nil ? "NO" : "YES")") } diff --git a/LiveRecipes/Modules/Creation/Dish.swift b/LiveRecipes/Modules/Creation/Dish.swift index d1234e6..4d936e1 100644 --- a/LiveRecipes/Modules/Creation/Dish.swift +++ b/LiveRecipes/Modules/Creation/Dish.swift @@ -18,7 +18,6 @@ class Dish: Identifiable, Hashable { } var id: Int?//если еще нет в базе данных, в процесе создания - var myId: Int = -1 var netId: Int = -1 var title: String var description: String @@ -67,7 +66,7 @@ class Dish: Identifiable, Hashable { dishCompositionsEntities: [CreationRecipeCompositionEntity], dishStepsEntities: [CreationRecipeStepEntity]) { - self.myId = Int(recipeEntity.recipeMyId) + self.id = Int(recipeEntity.recipeMyId) self.netId = Int(recipeEntity.recipeNetId) self.title = recipeEntity.dishTitle self.description = recipeEntity.dishDescription diff --git a/LiveRecipes/Modules/Creation/StepView.swift b/LiveRecipes/Modules/Creation/StepView.swift index 7489c46..c4e9e0b 100644 --- a/LiveRecipes/Modules/Creation/StepView.swift +++ b/LiveRecipes/Modules/Creation/StepView.swift @@ -13,10 +13,10 @@ struct StepView: View { didSet { print("dishStep did set") let totalSeconds = dishStep?.stepTime ?? 0 - hours = totalSeconds / 3600 + self.hours = totalSeconds / 3600 let remainingSeconds = totalSeconds % 3600 - minutes = remainingSeconds / 60 - seconds = remainingSeconds % 60 + self.minutes = remainingSeconds / 60 + self.seconds = remainingSeconds % 60 } } var creationViewModel: CreationViewModel