Remove old table reference from stats page

Fixes HANGAR-N
This commit is contained in:
Nassim Jahnke 2023-04-19 23:14:14 +02:00
parent 475304dfc2
commit 831db903a5
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
4 changed files with 3 additions and 11 deletions

View File

@ -2,5 +2,5 @@ package io.papermc.hangar.model.internal.admin;
import java.time.LocalDate; import java.time.LocalDate;
public record DayStats(LocalDate day, long reviews, long uploads, long totalDownloads, long unsafeDownloads, long flagsOpened, long flagsClosed) { public record DayStats(LocalDate day, long reviews, long uploads, long totalDownloads, long flagsOpened, long flagsClosed) {
} }

View File

@ -1,7 +1,6 @@
SELECT (SELECT count(*) FROM project_version_reviews WHERE ended_at::date = day) reviews, SELECT (SELECT count(*) FROM project_version_reviews WHERE ended_at::date = day) reviews,
(SELECT count(*) FROM project_versions WHERE created_at::date = day) uploads, (SELECT count(*) FROM project_versions WHERE created_at::date = day) uploads,
(SELECT count(*) FROM project_versions_downloads_individual WHERE created_at = day) totaldownloads, (SELECT count(*) FROM project_versions_downloads_individual WHERE created_at = day) totaldownloads,
(SELECT count(*) FROM project_version_unsafe_downloads WHERE created_at::date = day) unsafedownloads,
(SELECT count(*) FROM project_flags WHERE created_at::date <= day AND (created_at::date >= day OR resolved_at IS NULL)) flagsopened, (SELECT count(*) FROM project_flags WHERE created_at::date <= day AND (created_at::date >= day OR resolved_at IS NULL)) flagsopened,
(SELECT count(*) FROM project_flags WHERE resolved_at::date = day) flagsclosed, (SELECT count(*) FROM project_flags WHERE resolved_at::date = day) flagsclosed,
day::date day::date

View File

@ -822,7 +822,6 @@
"uploads": "Uploads", "uploads": "Uploads",
"downloads": "Downloads", "downloads": "Downloads",
"totalDownloads": "Total Downloads", "totalDownloads": "Total Downloads",
"unsafeDownloads": "Unsafe Downloads",
"flags": "Reports", "flags": "Reports",
"openedFlags": "Opened Reports", "openedFlags": "Opened Reports",
"closedFlags": "Closed Reports" "closedFlags": "Closed Reports"

View File

@ -29,7 +29,6 @@ interface DayStats {
flagsOpened: number; flagsOpened: number;
reviews: number; reviews: number;
totalDownloads: number; totalDownloads: number;
unsafeDownloads: number;
uploads: number; uploads: number;
} }
@ -49,7 +48,6 @@ let data: DayStats[] = (await useInternalApi<DayStats[]>("admin/stats", "get", {
let reviews: DayStat[] = []; let reviews: DayStat[] = [];
let uploads: DayStat[] = []; let uploads: DayStat[] = [];
let totalDownloads: DayStat[] = []; let totalDownloads: DayStat[] = [];
let unsafeDownloads: DayStat[] = [];
let openedFlags: DayStat[] = []; let openedFlags: DayStat[] = [];
let closedFlags: DayStat[] = []; let closedFlags: DayStat[] = [];
for (const statDay of data) { for (const statDay of data) {
@ -57,7 +55,6 @@ for (const statDay of data) {
reviews.push({ x: day, y: statDay.reviews }); reviews.push({ x: day, y: statDay.reviews });
uploads.push({ x: day, y: statDay.uploads }); uploads.push({ x: day, y: statDay.uploads });
totalDownloads.push({ x: day, y: statDay.totalDownloads }); totalDownloads.push({ x: day, y: statDay.totalDownloads });
unsafeDownloads.push({ x: day, y: statDay.unsafeDownloads });
openedFlags.push({ x: day, y: statDay.flagsOpened }); openedFlags.push({ x: day, y: statDay.flagsOpened });
closedFlags.push({ x: day, y: statDay.flagsClosed }); closedFlags.push({ x: day, y: statDay.flagsClosed });
} }
@ -68,8 +65,8 @@ const pluginData = ref<LineChartData>({
}); });
const downloadData = ref<LineChartData>({ const downloadData = ref<LineChartData>({
labels: [i18n.t("stats.totalDownloads"), i18n.t("stats.unsafeDownloads")], labels: [i18n.t("stats.totalDownloads")],
series: [totalDownloads, unsafeDownloads], series: [totalDownloads],
}); });
const flagData = ref<LineChartData>({ const flagData = ref<LineChartData>({
@ -104,7 +101,6 @@ async function updateDate() {
reviews = []; reviews = [];
uploads = []; uploads = [];
totalDownloads = []; totalDownloads = [];
unsafeDownloads = [];
openedFlags = []; openedFlags = [];
closedFlags = []; closedFlags = [];
for (const statDay of data) { for (const statDay of data) {
@ -112,14 +108,12 @@ async function updateDate() {
reviews.push({ x: day, y: statDay.reviews }); reviews.push({ x: day, y: statDay.reviews });
uploads.push({ x: day, y: statDay.uploads }); uploads.push({ x: day, y: statDay.uploads });
totalDownloads.push({ x: day, y: statDay.totalDownloads }); totalDownloads.push({ x: day, y: statDay.totalDownloads });
unsafeDownloads.push({ x: day, y: statDay.unsafeDownloads });
openedFlags.push({ x: day, y: statDay.flagsOpened }); openedFlags.push({ x: day, y: statDay.flagsOpened });
closedFlags.push({ x: day, y: statDay.flagsClosed }); closedFlags.push({ x: day, y: statDay.flagsClosed });
} }
pluginData.value.series[0] = reviews; pluginData.value.series[0] = reviews;
pluginData.value.series[1] = uploads; pluginData.value.series[1] = uploads;
downloadData.value.series[0] = totalDownloads; downloadData.value.series[0] = totalDownloads;
downloadData.value.series[1] = unsafeDownloads;
flagData.value.series[0] = openedFlags; flagData.value.series[0] = openedFlags;
flagData.value.series[1] = closedFlags; flagData.value.series[1] = closedFlags;
} }