Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Sewaaa committed Jan 11, 2024
1 parent 05a5b24 commit 1c8ae1c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/main/java/model/DAO/DAOExercise.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public List<Exercise> retrieveAllPatientExerciseDone(int userID) {
}

public List<Exercise> retrievePatientExerciseDone(int patientID) {
String query = "SELECT InsertionDate, Evaluation\n" +
String query = "SELECT *\n" +
"FROM exercise\n" +
"WHERE ID_user = ? AND Evaluation IS NOT NULL\n" +
"ORDER BY InsertionDate;";
Expand Down
12 changes: 12 additions & 0 deletions src/main/webapp/CSS/view_patient.css
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@
border-radius: 29px;
}

.singolo-paziente .overlap-5-2 {
display: flex;
align-items: center;
justify-content: center;
position: absolute;
width: 552px;
height: 248px;
top: 51vh;
left: 42vw;
border-radius: 29px;
}

.singolo-paziente .overlap-5 .errorProgress {
text-align: center;
display: flex;
Expand Down
45 changes: 24 additions & 21 deletions src/main/webapp/JSP/viewPatient.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,26 @@
<div class="button-chat"><img class="iconly-light-chat" src="../images/homeTherapist/iconly-light-chat.svg" /></div>
<!--Progress-->
<div class="text-wrapper-10">Andamento</div>
<div class="overlap-5">

<%
try {
ExerciseManager exerciseManager=new ExerciseManager();
List<Exercise> exercises = exerciseManager.retrievePatientExerciseDone(patientId);
if (exercises == null || exercises.isEmpty()) {
%>
<p class="errorProgress">Nessun esercizio eseguito</p>
<%
}else{
String labels = "";
String data = "";
for (Exercise exercise : exercises) {
labels += "'" + exercise.getInsertionDate() + "', ";
data += exercise.getEvaluation() + ", ";
}
labels = labels.substring(0, labels.length() - 2);
data = data.substring(0, data.length() - 2);
ExerciseManager exerciseManager = new ExerciseManager();
List<Exercise> exercises = exerciseManager.retrievePatientExerciseDone(patientId);
if (exercises == null || exercises.isEmpty()) {
%>
<div class="overlap-5"><p class="errorProgress">Nessun esercizio svolto</p></div>
<%
} else {
String labels = "";
String data = "";
for (Exercise exercise : exercises) {
labels += "'" + exercise.getInsertionDate() + "', ";
data += exercise.getEvaluation() + ", ";
}
labels = labels.substring(0, labels.length() - 2);
data = data.substring(0, data.length() - 2);
%>
<!-- Create Chart -->
<canvas id="myChart" width="400" height="200"></canvas>
<div class="overlap-5-2"><canvas id="myChart" width="400" height="200"></canvas></div>
<script>
var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
Expand All @@ -117,17 +116,21 @@
},
options: {
scales: {
x: [{
display: false, // Hide the x-axis
}],
y: {
title: {
display: true,
text: 'Valutazione'
},
beginAtZero: true
}
}
}
});
</script>
<%
}
} catch (Exception e) {
e.printStackTrace();
}
%>
</div>
Expand Down

0 comments on commit 1c8ae1c

Please sign in to comment.