fixed bug: some polls were shown several times in the list

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-03-10 10:16:27 +01:00
parent c9b9bb9fe5
commit 577e99d840
2 changed files with 9 additions and 3 deletions

View File

@@ -133,15 +133,17 @@ public class SqliteDb extends BaseDb implements PollDb {
ps.setLong(1,user.id()); ps.setLong(1,user.id());
ps.setLong(2, user.id()); ps.setLong(2, user.id());
var rs = ps.executeQuery(); var rs = ps.executeQuery();
var list = new ArrayList<Poll>(); var map = new HashMap<String,Poll>();
while (rs.next()) { while (rs.next()) {
var pollId = rs.getString(ID);
if (map.containsKey(pollId)) continue;
var poll = Poll.of(rs); var poll = Poll.of(rs);
var perm = rs.getInt(PERMISSION); var perm = rs.getInt(PERMISSION);
if (perm != 0) poll.permissions().put(user,Permission.of(perm)); if (perm != 0) poll.permissions().put(user,Permission.of(perm));
list.add(poll); map.put(pollId,poll);
} }
rs.close(); rs.close();
return list; return map.values().stream().sorted(Comparator.comparing(Poll::name)).toList();
} catch (SQLException sqle){ } catch (SQLException sqle){
throw failedToLoadObject(TABLE_POLLS); throw failedToLoadObject(TABLE_POLLS);
} }

View File

@@ -619,6 +619,10 @@ a.wikilink{
} }
} }
.poll .weight .description{
display: block;
margin: 0 5px;
}
@media screen and (max-width: 600px) { @media screen and (max-width: 600px) {
.grid2, .grid2,