Ensure all staff members are included in playtime mapping by adding default playtime data for missing UUIDs.
This commit is contained in:
parent
ff85b42190
commit
e8f952e7e2
|
|
@ -18,6 +18,12 @@ public final class StaffPtToStaffPlaytimeMapper {
|
|||
public List<StaffPlaytimeDto> map(List<StaffPt> sessions, List<Player> staffMembers, long from, long to) {
|
||||
Map<UUID, PlaytimeInfo> playtimeData = getUuidPlaytimeInfoMap(sessions, from, to);
|
||||
|
||||
for (Player staffMember : staffMembers) {
|
||||
if (!playtimeData.containsKey(staffMember.uuid())) {
|
||||
playtimeData.put(staffMember.uuid(), new PlaytimeInfo(0L, Long.MIN_VALUE));
|
||||
}
|
||||
}
|
||||
|
||||
List<StaffPlaytimeDto> results = new ArrayList<>(playtimeData.size());
|
||||
for (Map.Entry<UUID, PlaytimeInfo> entry : playtimeData.entrySet()) {
|
||||
long lastPlayedMillis = entry.getValue().lastPlayed() == Long.MIN_VALUE ? 0L : entry.getValue().lastPlayed();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user