Merge remote-tracking branch 'origin/main'

This commit is contained in:
Picman2000 2025-03-23 23:49:49 +01:00
commit ac79a35bfb
3 changed files with 42 additions and 3 deletions

View file

@ -331,6 +331,46 @@ public class MongoPprUtils {
return result;
}
/**
* Implementiert von Valentin
* Holt alle Reden eines Parlamentariers
* @param speakerId
* @return
*/
public static List<SpeechOverview> getSpeechesOverviewForSpeaker(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;
}
/**
* Implementiert von Valentin

View file

@ -45,8 +45,7 @@ public class SpeechController {
String parlamentarierId = ctx.pathParam("id");
ParlamentarierDetails p = MongoPprUtils.getParlamentarierDetailsByID(parlamentarierId);
List<SpeechMetaData> speechMetaDataList = MongoPprUtils.getSpeechesMetadataForSpeaker(parlamentarierId);
List<SpeechOverview> speechMetaDataList = MongoPprUtils.getSpeechesOverviewForSpeaker(Integer.parseInt(parlamentarierId));
Map<String, Object> attributes = new HashMap<>();
attributes.put("p", p);
attributes.put("speechesMetaDataList", speechMetaDataList);

View file

@ -32,7 +32,7 @@
<#list speechesMetaDataList as redeMd>
<tr>
<td>${redeMd.dateTimeString}</td>
<td><a href="/reden/${p.id}/${redeMd.speechKey}">${redeMd.agendaTitle}</a></td>
<td><a href="/reden/${p.id}/${redeMd.speechKey}">${redeMd.agendaTitel}</a></td>
</tr>
</#list>