| Línea 459... |
Línea 459... |
| 459 |
}
|
459 |
}
|
| Línea 460... |
Línea 460... |
| 460 |
|
460 |
|
| 461 |
func getCountCapsulesCompletedWithReturningByUserUuid(userUuid : String) -> Int {
|
461 |
func getCountCapsulesCompletedWithReturningByUserUuid(userUuid : String) -> Int {
|
| 462 |
let db = database.open()
|
462 |
let db = database.open()
|
| 463 |
var count = 0
|
463 |
var count = 0
|
| 464 |
let query = "SELECT COUNT(*) AS total FROM " + Constants.TABLE_PROGRESS
|
464 |
let query = "SELECT SUM(" + Constants.TABLE_PROGRESS_FIELD_RETURNING_AFTER_COMPLETED + ") AS total FROM " + Constants.TABLE_PROGRESS
|
| 465 |
+ " WHERE " + Constants.TABLE_PROGRESS_FIELD_USER_UUID + " = '\(userUuid)' " +
|
465 |
+ " WHERE " + Constants.TABLE_PROGRESS_FIELD_USER_UUID + " = '\(userUuid)' " +
|
| 466 |
" AND " + Constants.TABLE_PROGRESS_FIELD_TYPE + "= '\( Constants.PROGRESS_TYPE_CAPSULE)' " +
|
466 |
" AND " + Constants.TABLE_PROGRESS_FIELD_TYPE + "= '\( Constants.PROGRESS_TYPE_CAPSULE)' " +
|
| 467 |
" AND " + Constants.TABLE_PROGRESS_FIELD_COMPLETED + "= 1 " +
|
467 |
" AND " + Constants.TABLE_PROGRESS_FIELD_COMPLETED + "= 1 " +
|
| Línea 618... |
Línea 618... |
| 618 |
query = query + Constants.TABLE_PROGRESS_FIELD_RETURNING + " = '\(record.returning)', "
|
618 |
query = query + Constants.TABLE_PROGRESS_FIELD_RETURNING + " = '\(record.returning)', "
|
| 619 |
query = query + Constants.TABLE_PROGRESS_FIELD_RETURNING_AFTER_COMPLETED + " = '\(record.returningAfterCompleted)', "
|
619 |
query = query + Constants.TABLE_PROGRESS_FIELD_RETURNING_AFTER_COMPLETED + " = '\(record.returningAfterCompleted)', "
|
| 620 |
query = query + Constants.TABLE_PROGRESS_FIELD_COMPLETED + " = '\(record.completed)' "
|
620 |
query = query + Constants.TABLE_PROGRESS_FIELD_COMPLETED + " = '\(record.completed)' "
|
| 621 |
query = query + " WHERE " + Constants.TABLE_PROGRESS_FIELD_ID + " = \(record.id);"
|
621 |
query = query + " WHERE " + Constants.TABLE_PROGRESS_FIELD_ID + " = \(record.id);"
|
| Línea 622... |
Línea 622... |
| 622 |
|
622 |
|
| Línea 623... |
Línea 623... |
| 623 |
print("capsuleUpdate : \(query)")
|
623 |
//print("capsuleUpdate : \(query)")
|
| 624 |
|
624 |
|
| 625 |
var statement : OpaquePointer? = nil
|
625 |
var statement : OpaquePointer? = nil
|
| 626 |
if (sqlite3_prepare_v2(db, query, -1, &statement, nil) == SQLITE_OK) {
|
626 |
if (sqlite3_prepare_v2(db, query, -1, &statement, nil) == SQLITE_OK) {
|