[HOTFIX] 目標がない人は目標画面へ遷移できないバグを修正しました。
This commit is contained in:
@@ -49,11 +49,13 @@ public class GoalController {
|
|||||||
Model model,
|
Model model,
|
||||||
HttpSession session,
|
HttpSession session,
|
||||||
Long goalId) {
|
Long goalId) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
goalService.updateGoalComplete(userId);
|
goalService.updateGoalComplete(userId);
|
||||||
|
|
||||||
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
||||||
|
|
||||||
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
||||||
@@ -66,6 +68,10 @@ public class GoalController {
|
|||||||
"goalFormList",
|
"goalFormList",
|
||||||
goalFormList);
|
goalFormList);
|
||||||
|
|
||||||
|
model.addAttribute(
|
||||||
|
"achievementList",
|
||||||
|
new ArrayList<MonthlyAchievementForm>());
|
||||||
|
|
||||||
if (goalFormList.isEmpty()) {
|
if (goalFormList.isEmpty()) {
|
||||||
return "goal_view";
|
return "goal_view";
|
||||||
}
|
}
|
||||||
@@ -188,7 +194,8 @@ public class GoalController {
|
|||||||
month = month.minusMonths(1);
|
month = month.minusMonths(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.reverse(monthlySavingList);
|
Collections.reverse(
|
||||||
|
monthlySavingList);
|
||||||
|
|
||||||
List<MonthlyAchievementForm> achievementList = new ArrayList<>();
|
List<MonthlyAchievementForm> achievementList = new ArrayList<>();
|
||||||
|
|
||||||
@@ -280,11 +287,11 @@ public class GoalController {
|
|||||||
goalService.delete(goalId);
|
goalService.delete(goalId);
|
||||||
|
|
||||||
if (record == null) {
|
if (record == null) {
|
||||||
return "redirect:/goal";
|
return "redirect:/goal";
|
||||||
} else {
|
} else {
|
||||||
return "redirect:/goal/record";
|
return "redirect:/goal/record";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||||
|
|
||||||
<title>目標詳細</title>
|
<title>目標詳細</title>
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
@@ -11,14 +12,13 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
<div th:replace="~{header :: header}"></div>
|
|
||||||
|
|
||||||
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
|
|
||||||
<h1 class="page-title">目標詳細</h1>
|
<h1 class="page-title">目標詳細</h1>
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
<div th:if="${graphGoal != null}">
|
<div th:if="${graphGoal != null}">
|
||||||
|
|
||||||
<h2 th:text="${graphGoal.goalTitle}"></h2>
|
<h2 th:text="${graphGoal.goalTitle}"></h2>
|
||||||
@@ -30,30 +30,28 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="card shadow-sm mb-3">
|
<div class="card shadow-sm mb-3">
|
||||||
|
|
||||||
<div style="height: 400px;">
|
<div style="height: 400px;">
|
||||||
<canvas id="myChart"></canvas>
|
<canvas id="myChart"></canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
||||||
const months =
|
const months =
|
||||||
/*[[${achievementList.![month.monthValue]}]]*/[];
|
/*[[${achievementList.![month.monthValue]}]]*/[];
|
||||||
|
|
||||||
const achievementRates =
|
const achievementRates =
|
||||||
/*[[${achievementList.![achievementRate]}]]*/[];
|
/*[[${achievementList.![achievementRate]}]]*/[];
|
||||||
|
|
||||||
const labels =
|
const labels =
|
||||||
months.map(month => month + '月');
|
months.map(month => month + '月');
|
||||||
|
|
||||||
|
|
||||||
const myCt =
|
const myCt =
|
||||||
document.getElementById('myChart');
|
document.getElementById('myChart');
|
||||||
|
|
||||||
|
|
||||||
const myChart =
|
const myChart =
|
||||||
new Chart(myCt, {
|
new Chart(myCt, {
|
||||||
|
|
||||||
@@ -83,27 +81,34 @@
|
|||||||
options: {
|
options: {
|
||||||
|
|
||||||
responsive: true,
|
responsive: true,
|
||||||
|
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
|
|
||||||
scales: {
|
scales: {
|
||||||
|
|
||||||
y: {
|
y: {
|
||||||
|
|
||||||
beginAtZero: true,
|
beginAtZero: true,
|
||||||
|
|
||||||
max: 100,
|
max: 100,
|
||||||
|
|
||||||
ticks: {
|
ticks: {
|
||||||
|
|
||||||
callback: function (value) {
|
callback: function (value) {
|
||||||
return value + '%';
|
return value + '%';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<!-- -->
|
|
||||||
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
@@ -114,6 +119,7 @@
|
|||||||
<form th:action="@{/goal}" method="get" class="w-100">
|
<form th:action="@{/goal}" method="get" class="w-100">
|
||||||
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
|
|
||||||
<table class="table mb-0">
|
<table class="table mb-0">
|
||||||
|
|
||||||
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
|
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
|
||||||
@@ -146,6 +152,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
@@ -155,26 +162,29 @@
|
|||||||
<div class="d-flex justify-content-end gap-2 mt-3">
|
<div class="d-flex justify-content-end gap-2 mt-3">
|
||||||
|
|
||||||
<form th:action="@{/goal/edit}" method="get">
|
<form th:action="@{/goal/edit}" method="get">
|
||||||
|
|
||||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary">
|
<button type="submit" class="btn btn-sm btn-primary">
|
||||||
編集
|
編集
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form th:action="@{/goal/delete}" method="post">
|
<form th:action="@{/goal/delete}" method="post">
|
||||||
|
|
||||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-danger">
|
<button type="submit" class="btn btn-sm btn-danger">
|
||||||
削除
|
削除
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -186,6 +196,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form th:action="@{/goal/record}" method="get">
|
<form th:action="@{/goal/record}" method="get">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||||
@@ -193,7 +204,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user