aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/server/api/xnodeinfo2
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-11-07 19:14:04 +0300
committerGravatar Vitaly Takmazov2018-11-07 19:14:04 +0300
commit6412698e1dc06db48bea0459ca5238fb3ab2c52e (patch)
treeb6a167f27b0e49e674aa51b3ee7d570bd0524232 /juick-server/src/main/java/com/juick/server/api/xnodeinfo2
parent0541dc6e943f4c53c3be57dbe83e1324dbd1e068 (diff)
fix stats queries
Diffstat (limited to 'juick-server/src/main/java/com/juick/server/api/xnodeinfo2')
-rw-r--r--juick-server/src/main/java/com/juick/server/api/xnodeinfo2/Info.java7
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",