Proyectos de Subversion Android Microlearning - Nuevo Interface

Rev

Rev 19 | 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
 
24 gabriel 13
import java.util.List;
14
 
1 gabriel 15
@Dao
16
public interface ProgressDao {
17
 
19 gabriel 18
    @Query("SELECT COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 's' AND completed = 1 AND user_uuid = :userUuid")
19
    ResultCount getCountSlidesCompletedByTopicUuidAndUserUuid(String topicUuid, String userUuid);
1 gabriel 20
 
19 gabriel 21
    @Query("SELECT COUNT(*) AS count FROM tb_progress where topic_uuid = :topicUuid AND type = 'c' AND completed = 1 AND user_uuid = :userUuid")
22
    ResultCount getCountCapsulesCompletedByTopicUuidAndUserUuid(String topicUuid, String userUuid);
1 gabriel 23
 
19 gabriel 24
    @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")
25
    ResultCount getCountCapsulesCompletedWithoutReturningByTopicUuidAndUserUuid(String topicUuid, String userUuid);
1 gabriel 26
 
19 gabriel 27
    @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")
28
    ResultTotalInt getCountCapsulesCompletedWithReturningByTopicUuidAndUserUuid(String topicUuid, String userUuid);
1 gabriel 29
 
19 gabriel 30
    @Query("SELECT COUNT(*) AS count FROM tb_progress where capsule_uuid = :capsuleUuid AND user_uuid = :userUuid AND type = 's' AND completed = 1")
31
    ResultCount getCountSlidesCompletedByCapsuleUuidAndUserUuid(String capsuleUuid, String userUuid);
1 gabriel 32
 
33
    @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")
34
    ResultTotalInt getCountCapsulesCompletedWithReturningByTopicUuid(String topicUuid);
35
 
36
    @Query("SELECT COUNT(*) AS count FROM tb_progress where capsule_uuid = :capsuleUuid AND type = 's' AND completed = 1")
37
    ResultCount getCountSlidesCompletedByCapsuleUuid(String capsuleUuid);
38
 
39
 
40
    @Query("SELECT * FROM tb_progress WHERE topic_uuid = :topicUuid AND type = 't' LIMIT 1")
41
    Progress selectByTopicUuid(String topicUuid);
42
 
43
    @Query("SELECT * FROM tb_progress WHERE topic_uuid = :topicUuid AND user_uuid = :userUuid AND type = 't' LIMIT 1")
44
    Progress  selectByTopicUuidAndUserUuid(String topicUuid, String userUuid);
45
 
46
    @Query("SELECT * FROM tb_progress WHERE capsule_uuid = :capsuleUuid AND type = 'c' LIMIT 1")
47
    Progress selectByCapsuleUuid(String capsuleUuid);
48
 
24 gabriel 49
    @Query("SELECT * FROM tb_progress WHERE type = 'c' ORDER BY updated_on DESC")
50
    List<Progress> selectAllCapsulesProgress();
51
 
1 gabriel 52
    @Query("SELECT * FROM tb_progress WHERE capsule_uuid = :capsuleUuid AND user_uuid = :userUuid AND type = 'c' LIMIT 1")
53
    Progress selectByCapsuleUuidAndUserUuid(String capsuleUuid, String userUuid);
54
 
55
    @Query("SELECT * FROM tb_progress WHERE slide_uuid = :slideUuid AND type = 's' LIMIT 1")
56
    Progress selectBySlideUuid(String slideUuid);
57
 
58
    @Query("SELECT * FROM tb_progress WHERE slide_uuid = :slideUuid AND user_uuid = :userUuid AND type = 's' LIMIT 1")
59
    Progress selectBySlideUuidAndUserUuid(String slideUuid, String userUuid);
60
    @Insert
61
    void insert(Progress progress);
62
 
63
    @Update
64
    void update(Progress progress);
65
 
66
    @Query("DELETE FROM tb_progress WHERE id = :id")
67
    void remove(int id);
68
 
19 gabriel 69
    @Query("DELETE FROM tb_progress WHERE user_uuid != :userUuid")
1 gabriel 70
    void removeAllUserUuidNotEqual(String userUuid);
71
 
72
    @Query("DELETE FROM tb_progress")
73
    void removeAll();
74
 
75
}