Extract background color to continue image

This commit is contained in:
nemunaire 2024-03-18 11:26:01 +01:00
commit 26c282138e
23 changed files with 218 additions and 115 deletions

View file

@ -94,6 +94,7 @@ CREATE TABLE IF NOT EXISTS themes(
headline TEXT NOT NULL,
intro TEXT NOT NULL,
image VARCHAR(255) NOT NULL,
background_color INTEGER UNSIGNED NOT NULL,
authors TEXT NOT NULL,
partner_img VARCHAR(255) NOT NULL,
partner_href VARCHAR(255) NOT NULL,
@ -106,7 +107,7 @@ CREATE TABLE IF NOT EXISTS themes(
CREATE TABLE IF NOT EXISTS teams(
id_team INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
color INTEGER NOT NULL,
color INTEGER UNSIGNED NOT NULL,
active BOOLEAN NOT NULL DEFAULT 1,
external_id TEXT NOT NULL,
password VARCHAR(255) NULL
@ -144,6 +145,7 @@ CREATE TABLE IF NOT EXISTS exercices(
title VARCHAR(255) NOT NULL,
authors TEXT NOT NULL,
image VARCHAR(255) NOT NULL,
background_color INTEGER UNSIGNED NOT NULL,
disabled BOOLEAN NOT NULL DEFAULT 0,
headline TEXT NOT NULL,
url_id VARCHAR(255) NOT NULL,
@ -564,7 +566,7 @@ func DBRecreateDiscountedView() (err error) {
return
}
_, err = db.Exec("CREATE OR REPLACE VIEW exercices_discounted AS SELECT E.id_exercice, E.id_theme, E.title, E.authors, E.image, E.disabled, E.headline, E.url_id, E.path, E.statement, E.overview, E.issue, E.issue_kind, E.depend, E.gain - " + fmt.Sprintf("%f", DiscountedFactor) + " * E.gain * (COUNT(*) - 1) AS gain, E.coefficient_cur, E.finished, E.video_uri, E.resolution, E.seealso FROM exercices E LEFT OUTER JOIN exercice_solved S ON S.id_exercice = E.id_exercice GROUP BY E.id_exercice;")
_, err = db.Exec("CREATE OR REPLACE VIEW exercices_discounted AS SELECT E.id_exercice, E.id_theme, E.title, E.authors, E.image, E.background_color, E.disabled, E.headline, E.url_id, E.path, E.statement, E.overview, E.issue, E.issue_kind, E.depend, E.gain - " + fmt.Sprintf("%f", DiscountedFactor) + " * E.gain * (COUNT(*) - 1) AS gain, E.coefficient_cur, E.finished, E.video_uri, E.resolution, E.seealso FROM exercices E LEFT OUTER JOIN exercice_solved S ON S.id_exercice = E.id_exercice GROUP BY E.id_exercice;")
return
}