Fixed report_summart view
This commit is contained in:
@@ -237,29 +237,6 @@ class ReportWriterSQLite(ReportWriterABC):
|
|||||||
datetime TEXT
|
datetime TEXT
|
||||||
);"""
|
);"""
|
||||||
)
|
)
|
||||||
|
|
||||||
c.execute(
|
|
||||||
"""
|
|
||||||
CREATE VIEW IF NOT EXISTS report_summary AS
|
|
||||||
SELECT
|
|
||||||
report_id,
|
|
||||||
datetime(MIN(datetime)) start_time,
|
|
||||||
datetime(MAX(datetime)) end_time,
|
|
||||||
STRFTIME('%s',MAX(datetime)) - STRFTIME('%s',MIN(datetime)) AS duration_s,
|
|
||||||
SUM(exported) AS exported,
|
|
||||||
sum(new) as new,
|
|
||||||
SUM(updated) as updated,
|
|
||||||
SUM(skipped) as skipped,
|
|
||||||
SUM(sidecar_xmp) as sidecar_xmp,
|
|
||||||
SUM(touched) as touched,
|
|
||||||
SUM(converted_to_jpeg) as converted_to_jpeg,
|
|
||||||
SUM(missing) as missing,
|
|
||||||
SUM(CASE WHEN error = "" THEN 0 ELSE 1 END) as error,
|
|
||||||
SUM(cleanup_deleted_file) as cleanup_deleted_file
|
|
||||||
FROM report
|
|
||||||
GROUP BY report_id;"""
|
|
||||||
)
|
|
||||||
|
|
||||||
self._conn.commit()
|
self._conn.commit()
|
||||||
|
|
||||||
# migrate report table to add report_id if needed (#731)
|
# migrate report table to add report_id if needed (#731)
|
||||||
@@ -267,6 +244,30 @@ class ReportWriterSQLite(ReportWriterABC):
|
|||||||
self._conn.cursor().execute("ALTER TABLE report ADD COLUMN report_id TEXT;")
|
self._conn.cursor().execute("ALTER TABLE report ADD COLUMN report_id TEXT;")
|
||||||
self._conn.commit()
|
self._conn.commit()
|
||||||
|
|
||||||
|
# create report_summary view
|
||||||
|
c.execute(
|
||||||
|
"""
|
||||||
|
CREATE VIEW IF NOT EXISTS report_summary AS
|
||||||
|
SELECT
|
||||||
|
report_id,
|
||||||
|
datetime(MIN(datetime)) start_time,
|
||||||
|
datetime(MAX(datetime)) end_time,
|
||||||
|
STRFTIME('%s',MAX(datetime)) - STRFTIME('%s',MIN(datetime)) AS duration_s,
|
||||||
|
SUM(exported) AS exported,
|
||||||
|
sum(new) as new,
|
||||||
|
SUM(updated) as updated,
|
||||||
|
SUM(skipped) as skipped,
|
||||||
|
SUM(sidecar_xmp) as sidecar_xmp,
|
||||||
|
SUM(touched) as touched,
|
||||||
|
SUM(converted_to_jpeg) as converted_to_jpeg,
|
||||||
|
SUM(missing) as missing,
|
||||||
|
SUM(CASE WHEN error = "" THEN 0 ELSE 1 END) as error,
|
||||||
|
SUM(cleanup_deleted_file) as cleanup_deleted_file
|
||||||
|
FROM report
|
||||||
|
GROUP BY report_id;"""
|
||||||
|
)
|
||||||
|
self._conn.commit()
|
||||||
|
|
||||||
def _generate_report_id(self) -> int:
|
def _generate_report_id(self) -> int:
|
||||||
"""Get a new report ID for this report"""
|
"""Get a new report ID for this report"""
|
||||||
c = self._conn.cursor()
|
c = self._conn.cursor()
|
||||||
|
|||||||
Reference in New Issue
Block a user