Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  TopicCapsuleViewModel.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 6/29/22.
6
//
7
 
8
import Foundation
9
 
10
class TopicCardViewModel: ObservableObject {
11
 
12
    @Published var topic = TopicModel()
13
 
14
 
15
    public func fetch(topicUuid: String, userUuid : String)
16
    {
17 efrain 17
        let topicDao = TopicDao()
1 efrain 18
        self.topic = topicDao.selectByUuid(uuid: topicUuid)
19
        self.fetchProgress(topicUuid: topicUuid, userUuid: userUuid)
20
    }
21
 
22
    public func fetchProgress(topicUuid: String, userUuid : String)
23
    {
17 efrain 24
        let progressDao = ProgressDao()
1 efrain 25
        let progress = progressDao.selectByTopicUuidAndUserUuid(topicUuid: topicUuid, userUuid: userUuid)
26
        if progress.id > 0 {
27
            self.topic.progress = progress.progress
28
            self.topic.completed = progress.completed
29
        }
30
    }
31
}