Skip to content

Commit f454424

Browse files
committed
fix total mod download count sum
1 parent 348759b commit f454424

3 files changed

+28
-27
lines changed

.sqlx/query-96c66a14f97bea3f82b28325d41ed5a299bd78e8f419388be04ac89e70603286.json

-26
This file was deleted.

.sqlx/query-aafc069ab755eba12c641c8d536e2c8e3c4b4087046c399217b8347f26878acf.json

+26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/types/models/mod_entity.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,12 @@ pub struct ModStats {
111111
impl Mod {
112112
pub async fn get_stats(pool: &mut PgConnection) -> Result<ModStats, ApiError> {
113113
match sqlx::query!("
114-
SELECT COUNT(DISTINCT m.id), SUM(mv.download_count)
114+
SELECT COUNT(m.id), SUM(m.download_count)
115115
FROM mods m
116116
INNER JOIN mod_versions mv ON mv.mod_id = m.id
117117
INNER JOIN mod_version_statuses mvs ON mvs.mod_version_id = mv.id
118118
WHERE mvs.status = 'accepted'
119+
GROUP BY m.id
119120
")
120121
.fetch_optional(&mut *pool)
121122
.await

0 commit comments

Comments
 (0)