Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit abc1d62

Browse files
committed
fix: Adjust end date time to include the full day in product, order, and user counts
1 parent fb21ad3 commit abc1d62

4 files changed

Lines changed: 4 additions & 6 deletions

File tree

src/main/java/com/zenfulcode/commercify/auth/infrastructure/security/JwtAuthenticationFilter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ protected void doFilterInternal(
3030
try {
3131
String token = extractJwtToken(request);
3232

33-
System.out.println("Token: " + token);
34-
3533
if (token != null && SecurityContextHolder.getContext().getAuthentication() == null) {
3634
AuthenticatedUser user = authService.validateAccessToken(token);
3735

src/main/java/com/zenfulcode/commercify/order/domain/service/OrderDomainService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public boolean isOrderOwnedByUser(OrderId orderId, UserId userId) {
141141

142142
public BigDecimal calculateTotalRevenue(LocalDate startDate, LocalDate endDate) {
143143
Instant start = startDate.atStartOfDay().toInstant(ZoneOffset.from(ZoneOffset.UTC));
144-
Instant end = endDate.atStartOfDay().toInstant(ZoneOffset.UTC);
144+
Instant end = endDate.atTime(23, 59).toInstant(ZoneOffset.UTC);
145145

146146
// Implement logic to calculate total revenue based on the provided parameters
147147
// This is a placeholder implementation and should be replaced with actual logic
@@ -151,7 +151,7 @@ public BigDecimal calculateTotalRevenue(LocalDate startDate, LocalDate endDate)
151151

152152
public int countOrdersInPeriod(LocalDate startDate, LocalDate endDate) {
153153
Instant start = startDate.atStartOfDay().toInstant(ZoneOffset.from(ZoneOffset.UTC));
154-
Instant end = endDate.atStartOfDay().toInstant(ZoneOffset.UTC);
154+
Instant end = endDate.atTime(23, 59).toInstant(ZoneOffset.UTC);
155155

156156
return orderRepository.countOrders(start, end);
157157
}

src/main/java/com/zenfulcode/commercify/product/domain/service/ProductDomainService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public List<Product> getAllProductsById(Collection<ProductId> productIds) {
218218

219219
public int countNewProductsInPeriod(LocalDate startDate, LocalDate endDate) {
220220
Instant start = startDate.atStartOfDay().toInstant(ZoneOffset.from(ZoneOffset.UTC));
221-
Instant end = endDate.atStartOfDay().toInstant(ZoneOffset.UTC);
221+
Instant end = endDate.atTime(23, 59).toInstant(ZoneOffset.UTC);
222222

223223
return productRepository.findNewProducts(start, end);
224224
}

src/main/java/com/zenfulcode/commercify/user/domain/service/UserDomainService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public boolean emailExists(String email) {
167167

168168
public int findNewUsers(LocalDate startDate, LocalDate endDate) {
169169
Instant start = startDate.atStartOfDay().toInstant(ZoneOffset.from(ZoneOffset.UTC));
170-
Instant end = endDate.atStartOfDay().toInstant(ZoneOffset.UTC);
170+
Instant end = endDate.atTime(23, 59).toInstant(ZoneOffset.UTC);
171171

172172
return userRepository.findNewUsers(start, end);
173173
}

0 commit comments

Comments
 (0)