overhauled histograms

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-03-10 11:34:52 +01:00
parent 577e99d840
commit 2cd99f362b
13 changed files with 144 additions and 24 deletions

View File

@@ -11,7 +11,7 @@ import java.util.Map;
public interface PollDb {
Collection<Poll> listPolls(UmbrellaUser user);
Poll.Evaluation loadEvaluation(String id);
Poll.Evaluation loadEvaluation(Poll poll);
Poll loadPoll(String id);

View File

@@ -114,7 +114,7 @@ public class PollModule extends BaseHandler implements PollService {
}
}
var result = new HashMap<>(poll.toMap());
var evaluation = pollDb.loadEvaluation(poll.id());
var evaluation = pollDb.loadEvaluation(poll);
result.put(Field.EVALUATION,evaluation.toMap());
return sendContent(ex,result);
}

View File

@@ -150,10 +150,10 @@ public class SqliteDb extends BaseDb implements PollDb {
}
@Override
public Poll.Evaluation loadEvaluation(String pollId) {
public Poll.Evaluation loadEvaluation(Poll poll) {
try {
var result = new Poll.Evaluation();
var rs = select(ALL).from(TABLE_SELECTIONS).where(POLL_ID,equal(pollId)).exec(db);
var result = new Poll.Evaluation(poll);
var rs = select(ALL).from(TABLE_SELECTIONS).where(POLL_ID,equal(poll.id())).exec(db);
while (rs.next()) result.count(rs);
rs.close();
return result;