Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 1 | Rev 24 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 gabriel 1
package com.cesams.twogetskills.dao;
2
 
3
import androidx.room.Dao;
4
import androidx.room.Delete;
5
import androidx.room.Query;
6
import androidx.room.Insert;
7
import androidx.room.Update;
8
 
9
import com.cesams.twogetskills.entity.Progress;
10
import com.cesams.twogetskills.room.ResultCount;
11
import com.cesams.twogetskills.room.ResultTotalInt;
12
 
13
@Dao
14
public interface ProgressDao {
15
 
19 gabriel 16
    @Query("SELECT COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 's' AND completed = 1 AND user_uuid = :userUuid")
17
    ResultCount getCountSlidesCompletedByTopicUuidAndUserUuid(String topicUuid, String userUuid);
1 gabriel 18
 
19 gabriel 19
    @Query("SELECT COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 'c' AND completed = 1 AND user_uuid = :userUuid")
20
    ResultCount getCountCapsulesCompletedByTopicUuidAndUserUuid(String topicUuid, String userUuid);
1 gabriel 21
 
19 gabriel 22
    @Query("SELECT  COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 'c' AND completed = 1 AND user_uuid = :userUuid AND returning_after_completed = 0")
23
    ResultCount getCountCapsulesCompletedWithoutReturningByTopicUuidAndUserUuid(String topicUuid, String userUuid);
1 gabriel 24
 
19 gabriel 25
    @Query("SELECT SUM(returning_after_completed) AS total  FROM tb_progress where topic_uuid = :topicUuid AND user_uuid = :userUuid AND type = 'c' AND completed = 1 AND returning_after_completed > 0")
26
    ResultTotalInt getCountCapsulesCompletedWithReturningByTopicUuidAndUserUuid(String topicUuid, String userUuid);
1 gabriel 27
 
19 gabriel 28
    @Query("SELECT COUNT(*) AS count FROM tb_progress where capsule_uuid = :capsuleUuid AND user_uuid = :userUuid AND type = 's' AND completed = 1")
29
    ResultCount getCountSlidesCompletedByCapsuleUuidAndUserUuid(String capsuleUuid, String userUuid);
1 gabriel 30
 
31
    @Query("SELECT SUM(returning_after_completed) AS total  FROM tb_progress where topic_uuid = :topicUuid AND type = 'c' AND completed = 1 AND returning_after_completed > 0")
32
    ResultTotalInt getCountCapsulesCompletedWithReturningByTopicUuid(String topicUuid);
33
 
34
    @Query("SELECT COUNT(*) AS count FROM tb_progress where capsule_uuid = :capsuleUuid AND type = 's' AND completed = 1")
35
    ResultCount getCountSlidesCompletedByCapsuleUuid(String capsuleUuid);
36
 
37
 
38
    @Query("SELECT * FROM tb_progress WHERE topic_uuid = :topicUuid AND type = 't' LIMIT 1")
39
    Progress selectByTopicUuid(String topicUuid);
40
 
41
    @Query("SELECT * FROM tb_progress WHERE topic_uuid = :topicUuid AND user_uuid = :userUuid AND type = 't' LIMIT 1")
42
    Progress  selectByTopicUuidAndUserUuid(String topicUuid, String userUuid);
43
 
44
    @Query("SELECT * FROM tb_progress WHERE capsule_uuid = :capsuleUuid AND type = 'c' LIMIT 1")
45
    Progress selectByCapsuleUuid(String capsuleUuid);
46
 
47
    @Query("SELECT * FROM tb_progress WHERE capsule_uuid = :capsuleUuid AND user_uuid = :userUuid AND type = 'c' LIMIT 1")
48
    Progress selectByCapsuleUuidAndUserUuid(String capsuleUuid, String userUuid);
49
 
50
    @Query("SELECT * FROM tb_progress WHERE slide_uuid = :slideUuid AND type = 's' LIMIT 1")
51
    Progress selectBySlideUuid(String slideUuid);
52
 
53
    @Query("SELECT * FROM tb_progress WHERE slide_uuid = :slideUuid AND user_uuid = :userUuid AND type = 's' LIMIT 1")
54
    Progress selectBySlideUuidAndUserUuid(String slideUuid, String userUuid);
55
    @Insert
56
    void insert(Progress progress);
57
 
58
    @Update
59
    void update(Progress progress);
60
 
61
    @Query("DELETE FROM tb_progress WHERE id = :id")
62
    void remove(int id);
63
 
19 gabriel 64
    @Query("DELETE FROM tb_progress WHERE user_uuid != :userUuid")
1 gabriel 65
    void removeAllUserUuidNotEqual(String userUuid);
66
 
67
    @Query("DELETE FROM tb_progress")
68
    void removeAll();
69
 
70
}