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:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user