From 8302d8d804f8a736039a5468c4f1098e17314f84 Mon Sep 17 00:00:00 2001 From: Bruno Perel Date: Mon, 19 Aug 2024 22:50:09 +0200 Subject: [PATCH] stats-updater: Only store oldestdate at the end --- apps/stats-updater/Dockerfile | 1 - apps/stats-updater/index.ts | 19 ++++++++----------- apps/stats-updater/package.json | 2 +- .../android/capacitor.settings.gradle | 2 +- apps/whattheduck/ios/App/Podfile | 2 +- apps/whattheduck/ios/App/Podfile.lock | 16 +++++++++++----- apps/whattheduck/src/views/Login.vue | 2 +- 7 files changed, 23 insertions(+), 21 deletions(-) diff --git a/apps/stats-updater/Dockerfile b/apps/stats-updater/Dockerfile index eb62b1e99..3f7802fc6 100644 --- a/apps/stats-updater/Dockerfile +++ b/apps/stats-updater/Dockerfile @@ -8,7 +8,6 @@ COPY apps/stats-updater/bundle.mjs /app/ COPY packages/prisma-schemas/client_coa/ /client_coa COPY packages/prisma-schemas/client_dm/ /client_dm COPY packages/prisma-schemas/client_dm_stats/ /client_dm_stats -COPY packages/prisma-schemas/client_dm_stats_new/ /client_dm_stats_new COPY packages/prisma-schemas/schemas/dm_stats/migrations/0_init/migration.sql /dm-stats-ddl.sql EXPOSE 3000 diff --git a/apps/stats-updater/index.ts b/apps/stats-updater/index.ts index 7e0954b14..68a148ac2 100644 --- a/apps/stats-updater/index.ts +++ b/apps/stats-updater/index.ts @@ -22,7 +22,6 @@ for (const envKey of [ } } - process.env.DATABASE_URL_DM_STATS = process.env.DATABASE_URL_DM_STATS!.replace( "dm_stats", "dm_stats_new", @@ -129,11 +128,9 @@ connect().then(async () => { await prismaDmStats.storyIssue.createMany({ data: await prismaCoa.$queryRaw< (Pick & - Pick)[] + Pick)[] >` - select distinct sv.storycode, - i.issuecode, - i.oldestdate + select distinct sv.storycode, i.issuecode from inducks_storyjob sj inner join inducks_storyversion sv using (storyversioncode) inner join inducks_entry e using (storyversioncode) @@ -189,12 +186,11 @@ connect().then(async () => { console.log("Creating missingIssueForUser entries"); await prismaDmStats.$executeRaw` - insert into utilisateurs_publications_manquantes(ID_User, personcode, storycode, issuecode, oldestdate, Notation) + insert into utilisateurs_publications_manquantes(ID_User, personcode, storycode, issuecode, Notation) select distinct u_h_m.ID_User AS userId, u_h_m.personcode, u_h_m.storycode, h_p.issuecode, - h_p.oldestdate, a_p.Notation AS notation from utilisateurs_histoires_manquantes u_h_m inner join histoires_publications h_p using (storycode) @@ -205,18 +201,19 @@ connect().then(async () => { console.log("Creating suggestedIssueForUser entries"); await prismaDmStats.$executeRaw` insert into utilisateurs_publications_suggerees(ID_User, issuecode, oldestdate, Score) - select ID_User AS userId, issuecode, oldestdate, sum(Notation) AS score + select ID_User AS userId, issuecode, '0000-00-00', sum(Notation) AS score from utilisateurs_publications_manquantes - group by ID_User, issuecode, oldestdate`; + group by ID_User, issuecode`; await prismaDmStats.$executeRaw`OPTIMIZE TABLE utilisateurs_publications_suggerees`; - console.log("Adding publicationcode and issuenumber for WTD < 3"); + console.log("Adding oldestdate; adding publicationcode and issuenumber for WTD < 3"); await runQuery(` UPDATE ${dbName}_new.utilisateurs_publications_suggerees JOIN coa.inducks_issue i using (issuecode) SET utilisateurs_publications_suggerees.publicationcode = i.publicationcode - , utilisateurs_publications_suggerees.issuenumber = i.issuenumber`); + , utilisateurs_publications_suggerees.issuenumber = i.issuenumber + , utilisateurs_publications_suggerees.oldestdate = i.oldestdate`); await runQuery(`DROP DATABASE IF EXISTS ${dbName}_old`); diff --git a/apps/stats-updater/package.json b/apps/stats-updater/package.json index bfed90f90..b61ed08cf 100644 --- a/apps/stats-updater/package.json +++ b/apps/stats-updater/package.json @@ -4,7 +4,7 @@ "description": "Daily stats calculation for DucksManager", "main": "index.ts", "scripts": { - "build": "bun build --target bun --sourcemap index.ts --outfile bundle.mjs && SCHEMA='dm_stats' DATABASE_URL_DM_STATS=`sed 's/dm_stats/dm_stats_new/g' $DATABASE_URL_DM_STATS` pnpm -r -F '~prisma-clients' prisma-generate" + "build": "bun build --target bun --sourcemap index.ts --outfile bundle.mjs" }, "dependencies": { "dotenv": "^16.4.5", diff --git a/apps/whattheduck/android/capacitor.settings.gradle b/apps/whattheduck/android/capacitor.settings.gradle index d5e566c12..61c8e928a 100644 --- a/apps/whattheduck/android/capacitor.settings.gradle +++ b/apps/whattheduck/android/capacitor.settings.gradle @@ -33,4 +33,4 @@ include ':capawesome-capacitor-file-picker' project(':capawesome-capacitor-file-picker').projectDir = new File('../node_modules/.pnpm/@capawesome+capacitor-file-picker@6.0.1_@capacitor+core@6.1.2/node_modules/@capawesome/capacitor-file-picker/android') include ':capgo-capacitor-updater' -project(':capgo-capacitor-updater').projectDir = new File('../node_modules/.pnpm/@capgo+capacitor-updater@6.0.56_@capacitor+core@6.1.2/node_modules/@capgo/capacitor-updater/android') +project(':capgo-capacitor-updater').projectDir = new File('../node_modules/.pnpm/@capgo+capacitor-updater@6.1.0_@capacitor+core@6.1.2/node_modules/@capgo/capacitor-updater/android') diff --git a/apps/whattheduck/ios/App/Podfile b/apps/whattheduck/ios/App/Podfile index 9c05e5022..f69e29399 100644 --- a/apps/whattheduck/ios/App/Podfile +++ b/apps/whattheduck/ios/App/Podfile @@ -21,7 +21,7 @@ def capacitor_pods pod 'CapacitorPreferences', :path => '../../node_modules/.pnpm/@capacitor+preferences@6.0.2_@capacitor+core@6.1.2/node_modules/@capacitor/preferences' pod 'CapacitorStatusBar', :path => '../../node_modules/.pnpm/@capacitor+status-bar@6.0.1_@capacitor+core@6.1.2/node_modules/@capacitor/status-bar' pod 'CapawesomeCapacitorFilePicker', :path => '../../node_modules/.pnpm/@capawesome+capacitor-file-picker@6.0.1_@capacitor+core@6.1.2/node_modules/@capawesome/capacitor-file-picker' - pod 'CapgoCapacitorUpdater', :path => '../../node_modules/.pnpm/@capgo+capacitor-updater@6.0.56_@capacitor+core@6.1.2/node_modules/@capgo/capacitor-updater' + pod 'CapgoCapacitorUpdater', :path => '../../node_modules/.pnpm/@capgo+capacitor-updater@6.1.0_@capacitor+core@6.1.2/node_modules/@capgo/capacitor-updater' end target 'App' do diff --git a/apps/whattheduck/ios/App/Podfile.lock b/apps/whattheduck/ios/App/Podfile.lock index c7379bf6a..5532aaae8 100644 --- a/apps/whattheduck/ios/App/Podfile.lock +++ b/apps/whattheduck/ios/App/Podfile.lock @@ -25,10 +25,11 @@ PODS: - Capacitor - CapawesomeCapacitorFilePicker (6.0.1): - Capacitor - - CapgoCapacitorUpdater (6.0.56): + - CapgoCapacitorUpdater (6.1.0): - Alamofire - Capacitor - SSZipArchive + - SwiftyRSA - Version - SQLCipher (4.6.0): - SQLCipher/standard (= 4.6.0) @@ -36,6 +37,9 @@ PODS: - SQLCipher/standard (4.6.0): - SQLCipher/common - SSZipArchive (2.4.3) + - SwiftyRSA (1.7.0): + - SwiftyRSA/ObjC (= 1.7.0) + - SwiftyRSA/ObjC (1.7.0) - Version (0.8.0) - ZIPFoundation (0.9.19) @@ -52,13 +56,14 @@ DEPENDENCIES: - "CapacitorPreferences (from `../../node_modules/.pnpm/@capacitor+preferences@6.0.2_@capacitor+core@6.1.2/node_modules/@capacitor/preferences`)" - "CapacitorStatusBar (from `../../node_modules/.pnpm/@capacitor+status-bar@6.0.1_@capacitor+core@6.1.2/node_modules/@capacitor/status-bar`)" - "CapawesomeCapacitorFilePicker (from `../../node_modules/.pnpm/@capawesome+capacitor-file-picker@6.0.1_@capacitor+core@6.1.2/node_modules/@capawesome/capacitor-file-picker`)" - - "CapgoCapacitorUpdater (from `../../node_modules/.pnpm/@capgo+capacitor-updater@6.0.56_@capacitor+core@6.1.2/node_modules/@capgo/capacitor-updater`)" + - "CapgoCapacitorUpdater (from `../../node_modules/.pnpm/@capgo+capacitor-updater@6.1.0_@capacitor+core@6.1.2/node_modules/@capgo/capacitor-updater`)" SPEC REPOS: trunk: - Alamofire - SQLCipher - SSZipArchive + - SwiftyRSA - Version - ZIPFoundation @@ -88,7 +93,7 @@ EXTERNAL SOURCES: CapawesomeCapacitorFilePicker: :path: "../../node_modules/.pnpm/@capawesome+capacitor-file-picker@6.0.1_@capacitor+core@6.1.2/node_modules/@capawesome/capacitor-file-picker" CapgoCapacitorUpdater: - :path: "../../node_modules/.pnpm/@capgo+capacitor-updater@6.0.56_@capacitor+core@6.1.2/node_modules/@capgo/capacitor-updater" + :path: "../../node_modules/.pnpm/@capgo+capacitor-updater@6.1.0_@capacitor+core@6.1.2/node_modules/@capgo/capacitor-updater" SPEC CHECKSUMS: Alamofire: f36a35757af4587d8e4f4bfa223ad10be2422b8c @@ -104,12 +109,13 @@ SPEC CHECKSUMS: CapacitorPreferences: e8284bf740cf8c6d3f25409af3c01df87dfeb5a1 CapacitorStatusBar: b81d4fb5d4e0064c712018071b3ab4b810b39a63 CapawesomeCapacitorFilePicker: c80c30759ba48986ff34a2b51b23ac2babfd3774 - CapgoCapacitorUpdater: 68b02356624ca2d34054d72e7b28ce58a1cc7c7d + CapgoCapacitorUpdater: dfe4b49cfc661f2cb78e93e953eda3663063f836 SQLCipher: 30a8e81afa6128e600b17ffa77d0f92fa05ed208 SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef + SwiftyRSA: 8c6dd1ea7db1b8dc4fb517a202f88bb1354bc2c6 Version: de5907f2c5d0f3cf21708db7801d1d5401139486 ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c -PODFILE CHECKSUM: e5e4134b4adea0799f8c8c30043d78a0876bc749 +PODFILE CHECKSUM: d70f912f9b7ab7c250a222b9e860a3b950ab97fa COCOAPODS: 1.15.2 diff --git a/apps/whattheduck/src/views/Login.vue b/apps/whattheduck/src/views/Login.vue index 5ac376817..db5b32391 100644 --- a/apps/whattheduck/src/views/Login.vue +++ b/apps/whattheduck/src/views/Login.vue @@ -2,7 +2,7 @@ - {{ t('Connexion') }} + {{ t('Connexion') }}