Skip to content

Commit

Permalink
https://github.com/StephaneCouturier/Katalog/issues/496
Browse files Browse the repository at this point in the history
  • Loading branch information
StephaneCouturier committed Apr 12, 2024
1 parent ab8f329 commit 03021ff
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/mainwindow_tab_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3456,6 +3456,37 @@ void MainWindow::importStatistics()
query.prepare(querySQL);
query.exec();

//Update Storage file stats from Catalogs when snapshots
querySQL = QLatin1String(R"(
UPDATE statistics_device AS sd_storage
SET
device_file_count = (
SELECT SUM(sd_catalog.device_file_count)
FROM statistics_device AS sd_catalog
JOIN device AS d_catalog ON sd_catalog.device_id = d_catalog.device_id
WHERE
sd_catalog.date_time = sd_storage.date_time AND
sd_catalog.record_type = 'snapshot' AND
d_catalog.device_type = 'Catalog' AND
d_catalog.device_parent_id = sd_storage.device_id
),
device_total_file_size = (
SELECT SUM(sd_catalog.device_total_file_size)
FROM statistics_device AS sd_catalog
JOIN device AS d_catalog ON sd_catalog.device_id = d_catalog.device_id
WHERE
sd_catalog.date_time = sd_storage.date_time AND
sd_catalog.record_type = 'snapshot' AND
d_catalog.device_type = 'Catalog' AND
d_catalog.device_parent_id = sd_storage.device_id
)
WHERE
sd_storage.record_type = 'snapshot' AND
sd_storage.device_type = 'Storage';
)");
query.prepare(querySQL);
query.exec();

collection->saveStatiticsToFile();
}

Expand Down

0 comments on commit 03021ff

Please sign in to comment.