Browse Source

fixing sorting

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
main
Stephan Richter 11 months ago
parent
commit
2a2e941dfe
  1. 5
      src/main/java/de/srsoftware/widerhall/data/Post.java

5
src/main/java/de/srsoftware/widerhall/data/Post.java

@ -18,6 +18,7 @@ import java.sql.Timestamp; @@ -18,6 +18,7 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import static de.srsoftware.widerhall.Constants.*;
import static de.srsoftware.widerhall.Constants.VARCHAR;
@ -173,9 +174,9 @@ public class Post { @@ -173,9 +174,9 @@ public class Post {
return this;
}
public static HashMap<String, Object> summarize(MailingList list) throws SQLException {
public static Map<String, Object> summarize(MailingList list) throws SQLException {
var sql = new StringBuilder("SELECT count(*) as count,strftime('%Y-%m',date/1000,'unixepoch') as month FROM Posts WHERE list = ? GROUP BY month ORDER BY month;");
var map = new HashMap<String,Object>();
var map = new TreeMap<String,Object>();
var rs = Database.open().query(sql).compile(list.email()).exec();
while (rs.next()) map.put(rs.getString("month"),rs.getInt("count"));
rs.close();

Loading…
Cancel
Save