Nice things
This commit is contained in:
parent
7e4b1d50d7
commit
ac04dbf352
2 changed files with 51 additions and 33 deletions
|
|
@ -777,7 +777,7 @@ For ActivityPub federated posts and thumbnails:
|
|||
- [x] Followers/following lists (ActorDTO, GET /api/users/{username}/followers, GET /api/users/{username}/following)
|
||||
- [x] Follower/following counts (UserController.populateSocialCounts, UserDTO with followersCount/followingCount, frontend displays real counts)
|
||||
- [x] Heart rate chart over time on activity details (Chart.js line chart, elapsed time x-axis, heart rate y-axis)
|
||||
- [x] Speed/pace chart over time on activity details (Chart.js line chart with smoothing, displays speed in km/h with pace in tooltip)
|
||||
- [x] Speed/pace chart over time on activity details (Chart.js line chart with smoothin[69287079d5e0a4532ba818ee.fit](src/test/resources/69287079d5e0a4532ba818ee.fit)g, displays speed in km/h with pace in tooltip)
|
||||
- [x] Notifications system (Notification entity, NotificationRepository, NotificationService, NotificationController REST API, notifications.html UI, notification bell in nav with unread count, polling every 30s, mark as read/delete, all/unread filter tabs)
|
||||
- [x] Custom 404 Not Found page (error/404.html with animated compass icon, suggestions, gradient background)
|
||||
- [x] Custom 403 Forbidden page (error/403.html with shield-lock icon, auth-aware login button, gradient background)
|
||||
|
|
|
|||
|
|
@ -197,24 +197,33 @@ public class PersonalRecordService {
|
|||
.findByUserIdAndActivityTypeAndRecordType(userId, activityType, recordType);
|
||||
|
||||
if (existingRecord.isEmpty() || value.compareTo(existingRecord.get().getValue()) > 0) {
|
||||
PersonalRecord newRecord = PersonalRecord.builder()
|
||||
.userId(userId)
|
||||
.activityType(activityType)
|
||||
.recordType(recordType)
|
||||
.value(value)
|
||||
.unit(unit)
|
||||
.activityId(activityId)
|
||||
.achievedAt(achievedAt)
|
||||
.build();
|
||||
PersonalRecord recordToSave;
|
||||
|
||||
existingRecord.ifPresent(record -> {
|
||||
newRecord.setPreviousValue(record.getValue());
|
||||
newRecord.setPreviousAchievedAt(record.getAchievedAt());
|
||||
});
|
||||
if (existingRecord.isPresent()) {
|
||||
// Update existing record
|
||||
PersonalRecord existing = existingRecord.get();
|
||||
recordToSave = existing;
|
||||
recordToSave.setPreviousValue(existing.getValue());
|
||||
recordToSave.setPreviousAchievedAt(existing.getAchievedAt());
|
||||
recordToSave.setValue(value);
|
||||
recordToSave.setActivityId(activityId);
|
||||
recordToSave.setAchievedAt(achievedAt);
|
||||
} else {
|
||||
// Create new record
|
||||
recordToSave = PersonalRecord.builder()
|
||||
.userId(userId)
|
||||
.activityType(activityType)
|
||||
.recordType(recordType)
|
||||
.value(value)
|
||||
.unit(unit)
|
||||
.activityId(activityId)
|
||||
.achievedAt(achievedAt)
|
||||
.build();
|
||||
}
|
||||
|
||||
personalRecordRepository.save(newRecord);
|
||||
log.info("New personal record set: {} {} - {} {}", activityType, recordType, value, unit);
|
||||
return newRecord;
|
||||
personalRecordRepository.save(recordToSave);
|
||||
log.info("Personal record set: {} {} - {} {}", activityType, recordType, value, unit);
|
||||
return recordToSave;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -230,24 +239,33 @@ public class PersonalRecordService {
|
|||
.findByUserIdAndActivityTypeAndRecordType(userId, activityType, recordType);
|
||||
|
||||
if (existingRecord.isEmpty() || value.compareTo(existingRecord.get().getValue()) < 0) {
|
||||
PersonalRecord newRecord = PersonalRecord.builder()
|
||||
.userId(userId)
|
||||
.activityType(activityType)
|
||||
.recordType(recordType)
|
||||
.value(value)
|
||||
.unit(unit)
|
||||
.activityId(activityId)
|
||||
.achievedAt(achievedAt)
|
||||
.build();
|
||||
PersonalRecord recordToSave;
|
||||
|
||||
existingRecord.ifPresent(record -> {
|
||||
newRecord.setPreviousValue(record.getValue());
|
||||
newRecord.setPreviousAchievedAt(record.getAchievedAt());
|
||||
});
|
||||
if (existingRecord.isPresent()) {
|
||||
// Update existing record
|
||||
PersonalRecord existing = existingRecord.get();
|
||||
recordToSave = existing;
|
||||
recordToSave.setPreviousValue(existing.getValue());
|
||||
recordToSave.setPreviousAchievedAt(existing.getAchievedAt());
|
||||
recordToSave.setValue(value);
|
||||
recordToSave.setActivityId(activityId);
|
||||
recordToSave.setAchievedAt(achievedAt);
|
||||
} else {
|
||||
// Create new record
|
||||
recordToSave = PersonalRecord.builder()
|
||||
.userId(userId)
|
||||
.activityType(activityType)
|
||||
.recordType(recordType)
|
||||
.value(value)
|
||||
.unit(unit)
|
||||
.activityId(activityId)
|
||||
.achievedAt(achievedAt)
|
||||
.build();
|
||||
}
|
||||
|
||||
personalRecordRepository.save(newRecord);
|
||||
log.info("New personal record set: {} {} - {} {}", activityType, recordType, value, unit);
|
||||
return newRecord;
|
||||
personalRecordRepository.save(recordToSave);
|
||||
log.info("Personal record set: {} {} - {} {}", activityType, recordType, value, unit);
|
||||
return recordToSave;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue