@@ -11,17 +11,20 @@ public final class HomeViewModel: BaseViewModel, Stepper {
1111 private let fetchStudentInfoUseCase : FetchStudentInfoUseCase
1212 private let fetchApplicationUseCase : FetchApplicationUseCase
1313 private let fetchBannerListUseCase : FetchBannerListUseCase
14+ private let fetchTotalPassStudentUseCase : FetchTotalPassStudentUseCase
1415
1516 private var touchedPopcatCount = 0
1617
1718 init (
1819 fetchStudentInfoUseCase: FetchStudentInfoUseCase ,
1920 fetchApplicationUseCase: FetchApplicationUseCase ,
20- fetchBannerListUseCase: FetchBannerListUseCase
21+ fetchBannerListUseCase: FetchBannerListUseCase ,
22+ fetchTotalPassStudentUseCase: FetchTotalPassStudentUseCase
2123 ) {
2224 self . fetchStudentInfoUseCase = fetchStudentInfoUseCase
2325 self . fetchApplicationUseCase = fetchApplicationUseCase
2426 self . fetchBannerListUseCase = fetchBannerListUseCase
27+ self . fetchTotalPassStudentUseCase = fetchTotalPassStudentUseCase
2528 }
2629
2730 public struct Input {
@@ -40,12 +43,18 @@ public final class HomeViewModel: BaseViewModel, Stepper {
4043 let studentInfo : PublishRelay < StudentInfoEntity >
4144 let applicationList : PublishRelay < [ ApplicationEntity ] >
4245 let bannerList : BehaviorRelay < [ FetchBannerEntity ] >
46+ let totalPassStudentInfo : BehaviorRelay < TotalPassStudentEntity >
4347 }
4448
4549 public func transform( _ input: Input ) -> Output {
4650 let studentInfo = PublishRelay < StudentInfoEntity > ( )
4751 let applicationList = PublishRelay < [ ApplicationEntity ] > ( )
4852 let bannerList = BehaviorRelay < [ FetchBannerEntity ] > ( value: [ ] )
53+ let totalPassStudentInfo = BehaviorRelay < TotalPassStudentEntity > ( value: TotalPassStudentEntity . init (
54+ totalStudentCount: 0 ,
55+ passedCount: 0 ,
56+ approvedCount: 0
57+ ) )
4958
5059 input. viewAppear. asObservable ( )
5160 . flatMap { [ self ] in
@@ -94,6 +103,13 @@ public final class HomeViewModel: BaseViewModel, Stepper {
94103 . bind ( to: steps)
95104 . disposed ( by: disposeBag)
96105
106+ input. viewAppear. asObservable ( )
107+ . flatMap { [ self ] in
108+ fetchTotalPassStudentUseCase. execute ( )
109+ }
110+ . bind ( to: totalPassStudentInfo)
111+ . disposed ( by: disposeBag)
112+
97113 input. viewAppear. asObservable ( )
98114 . flatMap { [ self ] in
99115 fetchBannerListUseCase. execute ( )
@@ -146,7 +162,8 @@ public final class HomeViewModel: BaseViewModel, Stepper {
146162 return Output (
147163 studentInfo: studentInfo,
148164 applicationList: applicationList,
149- bannerList: bannerList
165+ bannerList: bannerList,
166+ totalPassStudentInfo: totalPassStudentInfo
150167 )
151168 }
152169}
0 commit comments