Fix getting of announcement and calendar count from database

The data type of the number returned by `COUNT(*)` is apparently a
bigint and r2dbc does not support mapping bigint to integer. So it is
mapped as a long and then converted to an integer.
This commit is contained in:
NovaFox161
2020-04-12 00:30:43 -05:00
parent b8d42da230
commit 64d7242ce2
@@ -600,9 +600,9 @@ public class DatabaseManager {
return Mono.from(c.createStatement(query).execute());
}).flatMapMany(res -> res.map((row, rowMetadata) -> {
Integer calendars = row.get(0, Integer.class);
Long calendars = row.get(0, Long.class);
return calendars == null ? 0 : calendars;
return calendars == null ? 0 : calendars.intValue();
}))
.next()
.onErrorResume(e -> {
@@ -939,8 +939,8 @@ public class DatabaseManager {
return Mono.from(c.createStatement(query).execute());
}).flatMapMany(res -> res.map((row, rowMetadata) -> {
Integer announcements = row.get(0, Integer.class);
return announcements == null ? 0 : announcements;
Long announcements = row.get(0, Long.class);
return announcements == null ? 0 : announcements.intValue();
}))
.next()
.onErrorResume(e -> {