Skip to content

Conversation

@warlockxins
Copy link
Collaborator

This was fun, and was able to experiment with more global config with spring.

@github-actions
Copy link

github-actions bot commented Oct 28, 2025

Test Results

18 tests   18 ✅  1s ⏱️
10 suites   0 💤
10 files     0 ❌

Results for commit 9e57c09.

♻️ This comment has been updated with latest results.


if (from != null && to != null) {
criteria = Criteria.where("createdAt").gte(from).lte(to);
criteria.lte(to);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lte is called twice

this.mongoTemplate = mongoTemplate;
}

Aggregation getSummaryStatsAggregation(ResponseFormat format, Instant from, Instant to) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it should be a private method

} else if (to != null) {
criteria = Criteria.where("createdAt").lte(to);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like lines 23-32 should be:

Criteria criteria = new Criteria();
if (from != null) {
criteria.gte(from);
}
if (to != null) {
criteria.lte(to);
}

Criteria criteria = new Criteria();

if (from != null && to != null) {
criteria = Criteria.where("createdAt").gte(from).lte(to);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to have string constans or enums for field names

return Aggregation.newAggregation(matchStage, countsFacet, project);
}

Long extractLong(Document doc, String key) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be private

Map<String, Long> userStats =
userStatsList.stream()
.collect(
java.util.stream.Collectors.toMap(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need package name (java.util.stream) as a prefix?

userStatsList.stream()
.collect(
java.util.stream.Collectors.toMap(
d -> d.getString("_id"), d -> ((Number) d.get("count")).longValue()));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extractLong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants