Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,18 @@ public DailyStatsViewModel getDailyStats(LocalDate selectedDate) {
);

int selectedIndex = days.size() - 1;
long sharedDailyReportCount = repo.countSharedDailyReports(selectedDate);
long selectedDateSharedDailyReportCount = repo.countSharedDailyReports(selectedDate);
DailyPeriodStatsViewModel selectedPeriod = new DailyPeriodStatsViewModel(
selectedDate.toString(),
selectedDate.toString(),
signupCounts.get(selectedIndex),
assignedCounts.get(selectedIndex),
completedCounts.get(selectedIndex),
sharedDailyReportCount
selectedDateSharedDailyReportCount
);
long sharedDailyReportCount = selectedDate.equals(today)
? selectedDateSharedDailyReportCount
: repo.countSharedDailyReports(today);

return new DailyStatsViewModel(
labels,
Expand All @@ -93,6 +96,7 @@ public DailyStatsViewModel getDailyStats(LocalDate selectedDate) {
signupPeak,
assignedQuestionPeak,
dauPeak,
sharedDailyReportCount,
OffsetDateTime.now(SEOUL).format(FMT)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ public record DailyStatsViewModel(
PeakStatViewModel signupPeak,
PeakStatViewModel assignedQuestionPeak,
PeakStatViewModel dauPeak,
long sharedDailyReportCount,
String refreshedAt // "2026-02-27 21:34:12"
) {}
8 changes: 8 additions & 0 deletions src/main/resources/templates/stats/daily.html
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,14 @@
th:href="@{/stats/total}">전체</a>
</div>

<!-- KPI -->
<div class="kpi-card">
<div>
<div class="kpi-label">현재 공유 중인 일간 리포트</div>
<div class="kpi-value" th:text="${#numbers.formatInteger(vm.sharedDailyReportCount, 1, 'COMMA')}">0</div>
</div>
</div>

<!-- Charts -->
<div class="charts-grid">
<!-- Chart 1 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ void getDailyStats_anchors_chart_and_summary_to_selected_date() {
when(repo.findCompletedDailyReportCountsLast7Days(startDate, selectedDate))
.thenReturn(List.of(new DateCountDto(selectedDate, 9L)));
when(repo.countSharedDailyReports(selectedDate)).thenReturn(2L);
when(repo.countSharedDailyReports(today)).thenReturn(4L);

DailyStatsViewModel vm = service.getDailyStats(selectedDate);

Expand All @@ -51,9 +52,12 @@ void getDailyStats_anchors_chart_and_summary_to_selected_date() {
assertThat(vm.selectedPeriod().assignedQuestionCount()).isEqualTo(7L);
assertThat(vm.selectedPeriod().dauCount()).isEqualTo(9L);
assertThat(vm.selectedPeriod().sharedDailyReportCount()).isEqualTo(2L);
assertThat(vm.sharedDailyReportCount()).isEqualTo(4L);

verify(repo).findSignupCountsLast7Days(startDate, selectedDate);
verify(repo).findAssignedQuestionCountsLast7Days(startDate, selectedDate);
verify(repo).findCompletedDailyReportCountsLast7Days(startDate, selectedDate);
verify(repo).countSharedDailyReports(selectedDate);
verify(repo).countSharedDailyReports(today);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void dailyStats_renders_peak_value_period_current_badge_and_empty_state() throws
currentPeak,
pastPeak,
PeakStatViewModel.empty(),
4_321L,
"2026-08-13 12:00:00"
));

Expand All @@ -86,6 +87,8 @@ void dailyStats_renders_peak_value_period_current_badge_and_empty_state() throws
.andExpect(content().string(containsString("value=\"2026-08-13\"")))
.andExpect(content().string(containsString("할당된 질문 수")))
.andExpect(content().string(containsString("DAU · 일간 리포트 작성자")))
.andExpect(content().string(containsString("현재 공유 중인 일간 리포트")))
.andExpect(content().string(containsString("4,321")))
.andExpect(content().string(containsString("공유 중인 일간 리포트")))
.andExpect(content().string(containsString("역대 최고")))
.andExpect(content().string(containsString("1,234")))
Expand All @@ -94,6 +97,8 @@ void dailyStats_renders_peak_value_period_current_badge_and_empty_state() throws
.andExpect(content().string(containsString("기록 없음")))
.andReturn().getResponse().getContentAsString();

assertThat(html.indexOf("현재 공유 중인 일간 리포트"))
.isLessThan(html.indexOf("<canvas id=\"signupChart\""));
assertThat(html.indexOf("<canvas id=\"completedChart\""))
.isLessThan(html.indexOf("선택한 일간 통계"));
}
Expand Down
Loading