diff options
Diffstat (limited to 'juick-server/src/main/java/com/juick')
-rw-r--r-- | juick-server/src/main/java/com/juick/server/api/xnodeinfo2/Info.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/juick-server/src/main/java/com/juick/server/api/xnodeinfo2/Info.java b/juick-server/src/main/java/com/juick/server/api/xnodeinfo2/Info.java index 0c6328c6..c12df55f 100644 --- a/juick-server/src/main/java/com/juick/server/api/xnodeinfo2/Info.java +++ b/juick-server/src/main/java/com/juick/server/api/xnodeinfo2/Info.java @@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RestController; import javax.inject.Inject; import java.time.Instant; +import java.time.ZonedDateTime; import java.time.temporal.ChronoUnit; import java.util.Arrays; @@ -34,8 +35,10 @@ public class Info { nodeInfo.setServices(serviceInfo); UserStats userStats = new UserStats(); userStats.setTotal(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM users WHERE banned=0", Integer.class)); - userStats.setActiveMonth(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM users WHERE banned=0 AND last_seen > ?", Integer.class, Instant.now().minus(1, ChronoUnit.MONTHS))); - userStats.setActiveHalfyear(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM users WHERE banned=0 AND last_seen > ?", Integer.class, Instant.now().minus(6, ChronoUnit.MONTHS))); + userStats.setActiveMonth(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM users WHERE banned=0 AND last_seen > ?", + Integer.class, ZonedDateTime.now().minus(1, ChronoUnit.MONTHS).toInstant())); + userStats.setActiveHalfyear(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM users WHERE banned=0 AND last_seen > ?", + Integer.class, ZonedDateTime.now().minus(6, ChronoUnit.MONTHS).toInstant())); Usage usage = new Usage(); usage.setUsers(userStats); usage.setLocalPosts(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM messages", |