Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 22 | Rev 26 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 22 Rev 24
Línea 120... Línea 120...
120
       //                                 object: nil, userInfo: ["slideUuid": slide.uuid])
120
       //                                 object: nil, userInfo: ["slideUuid": slide.uuid])
121
    }
121
    }
Línea 122... Línea 122...
122
    
122
    
123
    func completeSlide( slide : SlideModel)
123
    func completeSlide( slide : SlideModel)
124
    {
124
    {
125
        var changeProgress = false
125
        //var changeProgress = false
126
        let now = Date()
126
        let now = Date()
127
        let dateFormatter = DateFormatter()
127
        let dateFormatter = DateFormatter()
128
        dateFormatter.dateFormat = Constants.FORMAT_DATETIME_SERVICE
128
        dateFormatter.dateFormat = Constants.FORMAT_DATETIME_SERVICE
Línea 212... Línea 212...
212
            progressSlide.completed = 1
212
            progressSlide.completed = 1
213
            progressSlide.addedOn = dateOn
213
            progressSlide.addedOn = dateOn
214
            progressSlide.updatedOn = dateOn
214
            progressSlide.updatedOn = dateOn
215
            progressDao.insert(record: progressSlide)
215
            progressDao.insert(record: progressSlide)
Línea 216... Línea 216...
216
            
216
            
217
            changeProgress = true
217
            //changeProgress = true
Línea 218... Línea 218...
218
        } else {
218
        } else {
Línea 219... Línea 219...
219
            
219
            
Línea 264... Línea 264...
264
        
264
        
Línea 265... Línea 265...
265
        
265
        
266
 
266
 
267
                
267
                
Línea 298... Línea 298...
298
                progressCapsule.viewSlides = totalViews
298
                progressCapsule.viewSlides = totalViews
299
                progressCapsule.totalSlides = totalSlides
299
                progressCapsule.totalSlides = totalSlides
300
                progressCapsule.progress = Double(progress)
300
                progressCapsule.progress = Double(progress)
Línea -... Línea 301...
-
 
301
                
-
 
302
 
301
                
303
                print("capsuleUuidActive: \(appData.capsuleUuidActive) capsuleUuidOld : \(appData.capsuleUuidOld)")
302
 
304
                
303
                if progressCapsule.completed == 1 && slide.capsuleUuid != appData.capsuleUuidOld {
305
                if progressCapsule.completed == 1 && appData.capsuleUuidActive != appData.capsuleUuidOld {
Línea 304... Línea -...
304
                    progressCapsule.returningAfterCompleted = progressCapsule.returningAfterCompleted + 1
-
 
-
 
306
                    progressCapsule.returningAfterCompleted = progressCapsule.returningAfterCompleted + 1
305
                    progressDao.update(record: progressCapsule)
307
                    progressDao.update(record: progressCapsule)
306
                                
308
                                
Línea 307... Línea 309...
307
                    
309
                    
308
           
310
                    print("set capsuleUuidOld : \(appData.capsuleUuidActive)")
309
                    appData.capsuleUuidOld = slide.capsuleUuid
311
                    appData.capsuleUuidOld = appData.capsuleUuidActive
310
                    appData.save()
312
                    appData.save()
Línea 311... Línea 313...
311
                    
313
                    
312
                } else {
314
                } else {
Línea 313... Línea 315...
313
                    progressDao.update(record: progressCapsule)
315
                    progressDao.update(record: progressCapsule)
314
                }
316
                }
315
            }
317
            }
Línea 358... Línea 360...
358
                progressDao.update(record: progressTopic)
360
                progressDao.update(record: progressTopic)
359
            }
361
            }
Línea 360... Línea 362...
360
                
362
                
361
 
363
 
Línea 362... Línea 364...
362
                
364
                
363
            json = progressSlide.toJson()
365
            json = progressTopic.toJson()
364
            json[Constants.SYNC_ADAPTER_DATA_TYPE_FIELD_NAME] = Constants.SYNC_ADAPTER_DATA_TYPE_MICROLEARNING_PROGRESS
366
            json[Constants.SYNC_ADAPTER_DATA_TYPE_FIELD_NAME] = Constants.SYNC_ADAPTER_DATA_TYPE_MICROLEARNING_PROGRESS
365
                    
367
                    
366
            sync = SyncModel();
368
            sync = SyncModel();
367
            sync.type = Constants.SYNC_ADAPTER_TYPE_SYNC
369
            sync.type = Constants.SYNC_ADAPTER_TYPE_SYNC
Línea 368... Línea 370...
368
            if let theJSONData = try?  JSONSerialization.data(withJSONObject: json, options: .prettyPrinted),
370
            if let theJSONData = try?  JSONSerialization.data(withJSONObject: json, options: .prettyPrinted),
369
               let data = String(data: theJSONData, encoding: String.Encoding.ascii) {
371
               let data = String(data: theJSONData, encoding: String.Encoding.ascii) {
Línea 370... Línea 372...
370
                   sync.data = data
372
                   sync.data = data
371
                }
373
                }
372
                  
374