| | |
| | | fun getPackagesByDay(date: Long): Flow<List<Code>> |
| | | |
| | | @Query(""" |
| | | SELECT * FROM code |
| | | WHERE strftime('%Y-%W', substr(createtime, 1, 10)) = |
| | | strftime('%Y-%W', datetime(:date/1000, 'unixepoch', 'localtime')) |
| | | ORDER BY createtime DESC |
| | | """) |
| | | fun getPackagesByWeek(date: Long): Flow<List<Code>> |
| | | |
| | | @Query(""" |
| | | SELECT category as courierName, COUNT(*) as count |
| | | SELECT type as courierName, COUNT(*) as count |
| | | FROM code |
| | | WHERE strftime('%Y-%W', substr(createtime, 1, 10)) = |
| | | strftime('%Y-%W', datetime(:date/1000, 'unixepoch', 'localtime')) |
| | | GROUP BY category |
| | | GROUP BY type |
| | | ORDER BY count DESC |
| | | """) |
| | | fun getCourierStatsByWeek(date: Long): Flow<List<CourierStat>> |
| | | |
| | | @Query(""" |
| | | SELECT substr(createtime, 1, 10) as date, |
| | | COUNT(*) as count |
| | | SELECT strftime('%W', createtime) as date, |
| | | COUNT(*) as count, |
| | | MIN(createtime) as week_start |
| | | FROM code |
| | | WHERE strftime('%Y-%W', substr(createtime, 1, 10)) = |
| | | strftime('%Y-%W', datetime(:date/1000, 'unixepoch', 'localtime')) |
| | | GROUP BY substr(createtime, 1, 10) |
| | | WHERE strftime('%Y', createtime) = strftime('%Y', 'now') |
| | | GROUP BY strftime('%W', createtime) |
| | | ORDER BY week_start ASC |
| | | """) |
| | | fun getDailyStatsByWeek(date: Long): Flow<List<DailyStat>> |
| | | fun getDailyStatsByWeek(): Flow<List<DailyStat>> |
| | | |
| | | @Query(""" |
| | | SELECT * FROM code |
| | | WHERE substr(createtime, 1, 10) = |
| | | date(:date/1000, 'unixepoch', 'localtime') |
| | | ORDER BY createtime DESC |
| | | """) |
| | | fun getPackagesByWeek(date: Long): Flow<List<Code>> |
| | | } |