diff --git a/docs/SPECIFICATION.md b/docs/SPECIFICATION.md
index 78a05e0..f0f2290 100644
--- a/docs/SPECIFICATION.md
+++ b/docs/SPECIFICATION.md
@@ -151,8 +151,8 @@ REST API認証用のAPIキーを管理するモデル。
| 機能 | 説明 |
|------|------|
-| ダッシュボード | 課題の統計情報、本日期限の課題、期限切れ課題、今週期限の課題を表示 |
-| 課題一覧 | フィルタ付き(未完了/完了済み/期限切れ)で課題を一覧表示 |
+| ダッシュボード | 課題の統計情報、本日期限の課題、期限切れ課題、今週期限の課題を表示。各統計カードをクリックすると対応するフィルタで課題一覧に遷移 |
+| 課題一覧 | フィルタ付き(未完了/今日が期限/今週が期限/完了済み/期限切れ)で課題を一覧表示 |
| 課題登録 | タイトル、説明、教科、重要度、提出期限、通知設定を入力して新規登録 |
| 課題編集 | 既存の課題情報を編集 |
| 課題削除 | 課題を論理削除 |
diff --git a/internal/repository/assignment_repository.go b/internal/repository/assignment_repository.go
index 2092649..fb50d7b 100644
--- a/internal/repository/assignment_repository.go
+++ b/internal/repository/assignment_repository.go
@@ -148,11 +148,19 @@ func (r *AssignmentRepository) Search(userID uint, queryStr, priority, filter st
}
now := time.Now()
+ startOfDay := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
+ endOfDay := startOfDay.AddDate(0, 0, 1)
+ weekLater := startOfDay.AddDate(0, 0, 7)
+
switch filter {
case "completed":
dbQuery = dbQuery.Where("is_completed = ?", true)
case "overdue":
dbQuery = dbQuery.Where("is_completed = ? AND due_date < ?", false, now)
+ case "due_today":
+ dbQuery = dbQuery.Where("is_completed = ? AND due_date >= ? AND due_date < ?", false, startOfDay, endOfDay)
+ case "due_this_week":
+ dbQuery = dbQuery.Where("is_completed = ? AND due_date >= ? AND due_date < ?", false, startOfDay, weekLater)
default: // pending
dbQuery = dbQuery.Where("is_completed = ?", false)
}
@@ -195,12 +203,12 @@ type StatisticsFilter struct {
}
type AssignmentStatistics struct {
- Total int64
- Completed int64
- Pending int64
- Overdue int64
- CompletedOnTime int64
- OnTimeCompletionRate float64
+ Total int64
+ Completed int64
+ Pending int64
+ Overdue int64
+ CompletedOnTime int64
+ OnTimeCompletionRate float64
}
type SubjectStatistics struct {
@@ -217,11 +225,11 @@ func (r *AssignmentRepository) GetStatistics(userID uint, filter StatisticsFilte
now := time.Now()
stats := &AssignmentStatistics{}
baseQuery := r.db.Model(&models.Assignment{}).Where("user_id = ?", userID)
-
+
if filter.Subject != "" {
baseQuery = baseQuery.Where("subject = ?", filter.Subject)
}
-
+
if filter.From != nil {
baseQuery = baseQuery.Where("created_at >= ?", *filter.From)
}
@@ -338,4 +346,3 @@ func (r *AssignmentRepository) GetSubjectsByUserIDWithArchived(userID uint, incl
err := query.Distinct("subject").Pluck("subject", &subjects).Error
return subjects, err
}
-
diff --git a/web/templates/assignments/index.html b/web/templates/assignments/index.html
index 0046334..87cd58d 100644
--- a/web/templates/assignments/index.html
+++ b/web/templates/assignments/index.html
@@ -18,19 +18,43 @@
diff --git a/web/templates/assignments/statistics.html b/web/templates/assignments/statistics.html
index 1f3b705..b774e76 100644
--- a/web/templates/assignments/statistics.html
+++ b/web/templates/assignments/statistics.html
@@ -30,6 +30,20 @@
.pagination-info {
font-size: 0.875rem;
}
+
+ .stats-table {
+ min-width: 700px;
+ }
+
+ .stats-table th,
+ .stats-table td {
+ white-space: nowrap;
+ }
+
+ .stats-table th:first-child,
+ .stats-table td:first-child {
+ min-width: 120px;
+ }
{{end}}
@@ -174,7 +188,7 @@
-
+
| 科目 |
@@ -206,7 +220,7 @@
-
+
| 科目 |
diff --git a/web/templates/pages/dashboard.html b/web/templates/pages/dashboard.html
index 2205925..ecbfa79 100644
--- a/web/templates/pages/dashboard.html
+++ b/web/templates/pages/dashboard.html
@@ -65,6 +65,16 @@
font-size: 1.5rem;
font-weight: bold;
}
+
+ .dashboard-stat-card {
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
+ cursor: pointer;
+ }
+
+ .dashboard-stat-card:hover {
+ transform: translateY(-4px);
+ box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
+ }
{{end}}
@@ -83,56 +93,64 @@