UI: Fix end time of apps.

This commit is contained in:
Nodir Temirkhodjaev 2020-01-06 08:04:22 +05:00
parent cf6a69ccdb
commit 179fea6e7e

View File

@ -144,18 +144,17 @@ const char * const sqlSelectApps =
const char * const sqlSelectEndAppsCount = const char * const sqlSelectEndAppsCount =
"SELECT COUNT(*) FROM app" "SELECT COUNT(*) FROM app"
" WHERE end_time IS NOT NULL AND end_time != 0;" " WHERE end_time IS NOT NULL AND end_time != 0"
" AND blocked = 0;"
; ;
const char * const sqlSelectEndedApps = const char * const sqlSelectEndedApps =
"SELECT t.app_id," "SELECT t.app_id,"
" g.order_index as group_index," " g.order_index as group_index,"
" t.path," " t.path"
" (alert.app_id IS NOT NULL) as alerted"
" FROM app t" " FROM app t"
" JOIN app_group g ON g.app_group_id = t.app_group_id" " JOIN app_group g ON g.app_group_id = t.app_group_id"
" LEFT JOIN app_alert alert ON alert.app_id = t.app_id" " WHERE end_time <= ?1 AND blocked = 0;"
" WHERE end_time <= ?1;"
; ;
const char * const sqlInsertApp = const char * const sqlInsertApp =
@ -519,11 +518,9 @@ void ConfManager::updateAppEndTimes()
while (stmt.step() == SqliteStmt::StepRow) { while (stmt.step() == SqliteStmt::StepRow) {
const qint64 appId = stmt.columnInt64(0); const qint64 appId = stmt.columnInt64(0);
const int groupIndex = stmt.columnInt(1); const int groupIndex = stmt.columnInt(1);
const QString appPath = stmt.columnText(3); const QString appPath = stmt.columnText(2);
const bool alerted = stmt.columnBool(4);
if (updateDriverUpdateApp(appPath, groupIndex, if (updateDriverUpdateApp(appPath, groupIndex, false, true, false)
false, true, alerted)
&& updateApp(appId, QDateTime(), groupIndex, true)) { && updateApp(appId, QDateTime(), groupIndex, true)) {
isAppEndTimesUpdated = true; isAppEndTimesUpdated = true;
} }