Compare commits

...

2 Commits

Author SHA1 Message Date
SlimusMinus
91ceafe75b Merge pull request #53 from SlimusMinus/fix-empty_advert
All checks were successful
deploy-backend / deploy (push) Successful in 1m17s
fixed empty advertising
2026-10-19 01:22:52 +03:00
SlimusMinus
057cdddff6 fixed empty advertising 2026-10-19 01:22:08 +03:00
2 changed files with 4 additions and 3 deletions

View File

@@ -39,7 +39,8 @@ public class AdvertisingController {
log.info("getNextAdvertising");
Optional<SelectedAdvertisingDto> selected = advertisingSelectionService.selectAdvertising(authentication, sessionId, request);
if (selected.isEmpty()) {
log.warn("failed get advertising");
// Нормальная ситуация (нет активных реклам / кулдаун / кап) — не ошибка
log.debug("No advertising to show, returning 204");
return ResponseEntity.noContent().build();
}

View File

@@ -36,13 +36,13 @@ public class AdvertisingSelectionService {
String resolvedSessionId = sessionId != null ? sessionId : request.getSession(true).getId();
if (!frequencyService.isSessionCooldownPassed(resolvedSessionId)) {
log.warn("isSessionCooldownPassed by {} resolvedSessionId is empty", resolvedSessionId);
log.debug("Session cooldown not passed for sessionId={}", resolvedSessionId);
return Optional.empty();
}
List<Advertising> eligible = adRepository.findEligibleAds(LocalDateTime.now());
if (eligible.isEmpty()) {
log.warn("findEligibleAds is empty");
log.debug("No eligible ads to show");
return Optional.empty();
}