small enhancement

This commit is contained in:
vysitor 2025-03-23 17:50:33 +01:00
parent 9796b1366c
commit 62a35e30c7

View file

@ -626,6 +626,44 @@ public class MongoPprUtils {
return result;
}
/**
* Holt die Redeinformationen aus der Datenbank, die wichtig sind, um eine Liste der Reden eines Parlamentariers in HTML darzustellen
* @param speakerId
* @return
*/
public static List<SpeechOverview> getSpeechOverviewBySpeaker(Integer speakerId) {
List<SpeechOverview> result = new ArrayList<>();
MongoCollection<Document> collection = getSpeechCollection();
Document projection = new Document("speechKey", 1)
.append("speakerId", 1)
.append("dateTimeString", 1)
.append("speakerName", 1)
.append("fraction", 1)
.append("agendaTitel", 1);
Bson filter = Filters.eq("speakerId", speakerId);
List<Document> docs = collection.find(filter)
.projection(projection)
.sort(Sorts.descending("dateTime"))
.into(new ArrayList<>());
for (Document doc : docs) {
result.add(new SpeechOverview(
doc.getString("speechKey"),
doc.getInteger("speakerId"),
doc.getString("dateTimeString"),
doc.getString("speakerName"),
doc.getString("fraction"),
doc.getString("agendaTitel")
));
}
return result;
}
/**
* Füge Rede-Metadaten (welche in der Session-Collection stehen) der Rede hinzu.