Skip to content

Commit 46729c5

Browse files
authored
Merge pull request #9 from PhantoNull/develop
Release v1.4.1
2 parents ada80b3 + 71526ff commit 46729c5

File tree

4 files changed

+62
-34
lines changed

4 files changed

+62
-34
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<groupId>eu.rationence</groupId>
1414
<artifactId>PAT</artifactId>
15-
<version>1.4</version>
15+
<version>1.4.1</version>
1616
<name>PAT</name>
1717
<packaging>jar</packaging>
1818
<description>Project Activity Tracker Rationence</description>

src/main/java/eu/rationence/pat/controller/UserController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public ResponseEntity<String> changePasswordUser(Principal principal) throws Par
244244
return AdviceController.responseOk("Reminder sent to all users whom have not compiled yet");
245245
}
246246

247-
@Scheduled(cron = "0 0 13 1-10,L-3,L-2,L-1,L * *")
247+
@Scheduled(cron = "0 10 10 1-10,L-3,L-2,L-1,L * *")
248248
public void sendReminderTimeSheetEmail() throws ParseException {
249249
LocalDate currentDate = LocalDate.now();
250250
if(currentDate.getDayOfMonth() <= 10){

src/main/java/eu/rationence/pat/repository/ProjectActivityRepository.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import eu.rationence.pat.model.ProjectActivity;
44
import eu.rationence.pat.model.composite_keys.ProjectActivityCompositeKey;
5+
import org.springframework.data.jpa.repository.Query;
56
import org.springframework.data.repository.CrudRepository;
67
import org.springframework.stereotype.Repository;
78

@@ -12,6 +13,7 @@
1213
public interface ProjectActivityRepository extends CrudRepository<ProjectActivity, ProjectActivityCompositeKey> {
1314
ProjectActivity getActivityByActivityKeyAndProject(String activityKey, String projectKey);
1415

16+
@Query(value = "SELECT * FROM PAT_Activities WHERE c_Project = ?1 ORDER BY d_Start ASC", nativeQuery = true)
1517
List<ProjectActivity> findActivitiesByProject(String projectKey);
1618

1719
<S extends ProjectActivity> S save(S projectActivity);

src/main/resources/templates/activities.html

Lines changed: 58 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -122,24 +122,27 @@
122122

123123
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
124124
<script type="text/javascript">
125-
google.charts.load('current', {'packages':['gantt']});
125+
google.charts.load("current", {packages:["timeline"]});
126126
google.charts.setOnLoadCallback(drawChart);
127-
128127
function drawChart() {
129-
let data = new google.visualization.DataTable();
130-
data.addColumn('string', 'Task ID');
131-
data.addColumn('string', 'Task Name');
132-
data.addColumn('string', 'Resource');
133-
data.addColumn('date', 'Start Date');
134-
data.addColumn('date', 'End Date');
135-
data.addColumn('number', 'Duration');
136-
data.addColumn('number', 'Percent Complete');
137-
data.addColumn('string', 'Dependencies');
128+
if(project_end == null){
129+
let projectGantt = document.getElementById('ganttContainer');
130+
projectGantt.classList.add('hidden');
131+
return;
132+
}
133+
var container = document.getElementById('ganttChart');
134+
var chart = new google.visualization.Timeline(container);
135+
var data = new google.visualization.DataTable();
136+
data.addColumn({ type: 'string', id: 'Term' });
137+
data.addColumn({ type: 'string', id: 'Name' });
138+
data.addColumn({ type: 'date', id: 'Start' });
139+
data.addColumn({ type: 'date', id: 'End' });
138140

139141
data.addRows([
140-
[project_name, project_name, project_name,
141-
new Date(project_start), new Date(project_end), project_value, 100, null],
142+
[project_name, project_name,
143+
new Date(project_start), new Date(project_end)],
142144
]);
145+
let colorArray = ["#386671",];
143146

144147
for(let i=0; i<activity_num; i++) {
145148
let activityKey = document.getElementById("activityKey"+i).value;
@@ -149,25 +152,46 @@
149152
let activityDays = document.getElementById("manDays"+i).value * 8;
150153
let activityTotHoursCompiled = document.getElementById("TotHoursCompiled"+activityKey).value;
151154
let activityPercentage = Math.round(100 * (activityTotHoursCompiled / activityDays));
155+
let colorActivityBar = "#59a5b7"
156+
if(activityPercentage > 100)
157+
colorActivityBar = "#9b2222"
158+
else if(activityPercentage === 100)
159+
colorActivityBar = "#32c574"
160+
else if(activityPercentage === 0)
161+
colorActivityBar = "#8AB4B1"
162+
colorArray.push(colorActivityBar)
152163
if(activityDateEnd === "")
153164
activityDateEnd = project_end;
154165
data.addRows([
155-
[activityKey, activityKey, activityType,
156-
new Date(activityDateStart), new Date(activityDateEnd), activityDays, activityPercentage, null],
157-
]);
166+
[activityKey, "" + Math.round(activityTotHoursCompiled/8) + "/" + activityDays/8 + "gg (" + activityPercentage + "%)",
167+
new Date(activityDateStart), new Date(activityDateEnd)],
168+
]);
158169
}
159-
let options = {
160-
gantt: {
161-
trackHeight: 20,
162-
barHeight: 15
163-
}
170+
console.log(colorArray);
171+
var options = {
172+
rowLabelStyle: {
173+
fontSize: 10,
174+
},
175+
backgroundColor: "#f1f7f8",
176+
colors: colorArray,
177+
height: (1+activity_num)*50,
178+
timeline: { showRowLabels: true,
179+
barLabelStyle: {
180+
fontSize: 10
181+
},
182+
},
183+
164184
};
165-
var chart = new google.visualization.Gantt(document.getElementById('chart_div'));
185+
166186
chart.draw(data, options);
167187
}
188+
window.addEventListener('resize', function(event) {
189+
drawChart();
190+
}, true);
168191
</script>
169192

170193

194+
171195
<section class="">
172196
<div class="container mt-6">
173197
<div class="columns">
@@ -336,42 +360,42 @@
336360
<span class="icon has-text-primary is-pulled-right mr-1"
337361
data-tooltip="Order">
338362
<i class="fas fa-sort fa-lg table-button is-clickable"
339-
th:onclick="'sortTable(\'activityKey\',columnList);'"></i>
363+
th:onclick="'sortTable(\'activityKey\',columnList), drawChart();'"></i>
340364
</span>
341365
</th>
342366
<th class="activityTypeCol has-text-primary-dark table-header pl-2">Type
343367
<span class="icon has-text-primary is-pulled-right mr-1"
344368
data-tooltip="Order">
345369
<i class="fas fa-sort fa-lg table-button is-clickable"
346-
th:onclick="'sortTable(\'activityType\',columnList);'"></i>
370+
th:onclick="'sortTable(\'activityType\',columnList), drawChart();'"></i>
347371
</span>
348372
</th>
349373
<th class="dateCol has-text-primary-dark table-header pl-2">Start Date
350374
<span class="icon has-text-primary is-pulled-right mr-1"
351375
data-tooltip="Order">
352376
<i class="fas fa-sort fa-lg table-button is-clickable"
353-
th:onclick="'sortTable(\'dateStart\',columnList);'"></i>
377+
th:onclick="'sortTable(\'dateStart\',columnList), drawChart();'"></i>
354378
</span>
355379
</th>
356380
<th class="dateCol has-text-primary-dark table-header pl-2">End Date
357381
<span class="icon has-text-primary is-pulled-right mr-1"
358382
data-tooltip="Order">
359383
<i class="fas fa-sort fa-lg table-button is-clickable"
360-
th:onclick="'sortTable(\'dateEnd\',columnList);'"></i>
384+
th:onclick="'sortTable(\'dateEnd\',columnList), drawChart();'"></i>
361385
</span>
362386
</th>
363387
<th class="chargedCol has-text-primary-dark table-header pl-2">Charged
364388
<span class="icon has-text-primary is-pulled-right mr-1"
365389
data-tooltip="Order">
366390
<i class="fas fa-sort fa-lg table-button is-clickable"
367-
th:onclick="'sortTable(\'charged\',columnList);'"></i>
391+
th:onclick="'sortTable(\'charged\',columnList), drawChart();'"></i>
368392
</span>
369393
</th>
370394
<th class="manDaysCol has-text-primary-dark table-header pl-2">Days
371395
<span class="icon has-text-primary is-pulled-right mr-1"
372396
data-tooltip="Order">
373397
<i class="fas fa-sort fa-lg table-button is-clickable"
374-
th:onclick="'sortTable(\'manDays\',columnList);'"></i>
398+
th:onclick="'sortTable(\'manDays\',columnList), drawChart();'"></i>
375399
</span>
376400
</th>
377401
<th></th>
@@ -490,10 +514,12 @@
490514
</div>
491515
</div>
492516
</div>
493-
<p class="subtitle has-text-weight-bold has-text-centered has-text-primary-dark has-text-weight-semibold m-auto mt-5 mb-3">Project summary</p>
494-
<div class="columns is-centered">
495-
<div class="column is-flexible">
496-
<div id="chart_div"></div>
517+
<div id="ganttContainer" class="mt-2" style="font-weight: bold;">
518+
<p class="subtitle has-text-weight-bold has-text-centered has-text-primary-dark has-text-weight-semibold m-auto mt-5 mb-3">Project summary</p>
519+
<div class="columns is-centered">
520+
<div class="column">
521+
<div id="ganttChart" class="mt-3"></div>
522+
</div>
497523
</div>
498524
</div>
499525
</div>

0 commit comments

Comments
 (0)