From f6ce30a8a7866c157a529f11561d5a7f11bb734f Mon Sep 17 00:00:00 2001
From: mtierltd <49143074+mtierltd@users.noreply.github.com>
Date: Sun, 8 Nov 2020 13:21:34 +0100
Subject: [PATCH 001/157] add support for nextcloud 20
---
appinfo/info.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/appinfo/info.xml b/appinfo/info.xml
index d1daee1..30542d5 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -5,7 +5,7 @@
Time TrackerTime Tracker App
- 0.0.43
+ 0.0.44agplMTier Ltd.TimeTracker
@@ -15,7 +15,7 @@
toolshttps://github.com/mtierltd/timetracker/issues
-
+
From d4c8aadc50b099ff246ef485298d02a2a06eff6d Mon Sep 17 00:00:00 2001
From: Robert Nagy
Date: Sun, 8 Nov 2020 13:53:18 +0100
Subject: [PATCH 002/157] zero-pad hours, minutes and seconds in the time
Timelines and Reports views
closes #54
---
js/reports.js | 9 +++++++--
js/timelines.js | 9 +++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/js/reports.js b/js/reports.js
index a1e4f91..ab28553 100644
--- a/js/reports.js
+++ b/js/reports.js
@@ -158,6 +158,11 @@
function getReport(){
var baseUrl = OC.generateUrl('/apps/timetracker/ajax/report?name=&from='+start.unix()+'&to='+end.unix()+'&group1='+group1+'&group2='+group2+'&timegroup='+group3+'&filterProjectId='+filterProjectId+'&filterClientId='+filterClientId);
+ function pad(n, width, z) {
+ z = z || '0';
+ n = n + '';
+ return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
+ }
var table = new Tabulator("#report", {
ajaxURL:baseUrl,
layout:"fitColumns",
@@ -179,7 +184,7 @@
var m = Math.floor( (duration/60) % 60 );
var h = Math.floor( (duration/(60*60)));
- return h + ':' + m + ':' + s;
+ return pad(h,2) + ':' + pad(m,2) + ':' + pad(s,2);
},bottomCalc:"sum", bottomCalcParams:{
precision:1,
@@ -192,7 +197,7 @@
var m = Math.floor( (duration/60) % 60 );
var h = Math.floor( (duration/(60*60)));
- return h + ':' + m + ':' + s;
+ return pad(h,2) + ':' + pad(m,2) + ':' + pad(s,2);
}}, //column will be allocated 1/5 of the remaining space
],
diff --git a/js/timelines.js b/js/timelines.js
index 5e322f3..e7eb482 100644
--- a/js/timelines.js
+++ b/js/timelines.js
@@ -173,6 +173,11 @@
function getReport(){
var baseUrl = OC.generateUrl('/apps/timetracker/ajax/report?name=&from='+start.unix()+'&to='+end.unix()+'&group1='+group1+'&group2='+group2+'&timegroup='+group3+'&filterProjectId='+filterProjectId+'&filterClientId='+filterClientId);
+ function pad(n, width, z) {
+ z = z || '0';
+ n = n + '';
+ return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
+ }
var table = new Tabulator("#report", {
ajaxURL:baseUrl,
layout:"fitColumns",
@@ -193,7 +198,7 @@
var m = Math.floor( (duration/60) % 60 );
var h = Math.floor( (duration/(60*60)));
- return h + ':' + m + ':' + s;
+ return pad(h,2) + ':' + pad(m,2) + ':' + pad(s,2);
},}, //column will be allocated 1/5 of the remaining space
],
@@ -322,4 +327,4 @@
} );
-}());
\ No newline at end of file
+}());
From 65db2deb3d9ef45241e56caf523664294648c61b Mon Sep 17 00:00:00 2001
From: Robert Nagy
Date: Sun, 8 Nov 2020 14:48:10 +0100
Subject: [PATCH 003/157] add support for changing the timeline in the Timer
main view
closes #51
---
js/timer.js | 37 +++++++++++++++++++++++++++++--
lib/Controller/AjaxController.php | 4 ++--
lib/Db/WorkIntervalMapper.php | 2 +-
templates/content/index.php | 11 ++++++++-
4 files changed, 48 insertions(+), 6 deletions(-)
diff --git a/js/timer.js b/js/timer.js
index c332664..58ae183 100644
--- a/js/timer.js
+++ b/js/timer.js
@@ -4,6 +4,39 @@
$( function() {
+ var days='31';
+ var start = moment().subtract(29, 'days');
+ var end = moment();
+
+ function cb(start, end) {
+ $('#report-range span').html(start.format('DD/MM/YY') + ' - ' + end.format('DD/MM/YY'));
+ }
+ $("#report-range").daterangepicker({
+ timePicker: false,
+ startDate: start,
+ endDate: end,
+ ranges: {
+ 'Today': [moment(), moment()],
+ 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
+ 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
+ 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
+ 'Last 90 Days': [moment().subtract(89, 'days'), moment()],
+ 'Last 365 Days': [moment().subtract(364, 'days'), moment()],
+ 'This Month': [moment().startOf('month'), moment().endOf('month')],
+ 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
+ 'The Month Before Last': [moment().subtract(2, 'month').startOf('month'), moment().subtract(2, 'month').endOf('month')],
+ 'This Year': [moment().startOf('year'), moment().endOf('year')],
+ 'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')],
+ },
+ locale: {
+ format: 'DD/MM/YY'
+ }
+ },cb);
+ $("#report-range").on('apply.daterangepicker', function(ev, picker) {
+ days = (picker.endDate.unix()-picker.startDate.unix()) / 86400;
+ getWorkItems();
+ });
+ cb(start, end);
var entityMap = {
'&': '&',
@@ -180,7 +213,7 @@
return formattedTime;
}
function getWorkItems(){
- var baseUrl = OC.generateUrl('/apps/timetracker/ajax/work-intervals');
+ var baseUrl = OC.generateUrl('/apps/timetracker/ajax/work-intervals?days='+days);
$.ajaxSetup({
scriptCharset: "utf-8",
//contentType: "application/json; charset=utf-8"
@@ -527,4 +560,4 @@
});
} );
-}());
\ No newline at end of file
+}());
diff --git a/lib/Controller/AjaxController.php b/lib/Controller/AjaxController.php
index 8d42d1c..20d1e04 100644
--- a/lib/Controller/AjaxController.php
+++ b/lib/Controller/AjaxController.php
@@ -73,9 +73,9 @@ public function __construct($AppName, IRequest $request, IUserSession $userSessi
*
* @NoAdminRequired
*/
- public function workIntervals() {
+ public function workIntervals($days) {
$i = 0;
- $tryIntervals=[90,180,365,365*5];
+ $tryIntervals=[$days,90,180,365,365*5];
do {
$l = $this->workIntervalMapper->findLatestDays($this->userId,$tryIntervals[$i],0);
$i++;
diff --git a/lib/Db/WorkIntervalMapper.php b/lib/Db/WorkIntervalMapper.php
index 58bccb8..a371862 100644
--- a/lib/Db/WorkIntervalMapper.php
+++ b/lib/Db/WorkIntervalMapper.php
@@ -105,4 +105,4 @@ public function deleteAllForProject($project_id) {
}
-}
\ No newline at end of file
+}
diff --git a/templates/content/index.php b/templates/content/index.php
index 148aff8..8a4f5a7 100644
--- a/templates/content/index.php
+++ b/templates/content/index.php
@@ -56,7 +56,16 @@
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
From 9e2163a265bbefedf8a48266fb61b6c2d4e06717 Mon Sep 17 00:00:00 2001
From: Robert Nagy
Date: Sun, 8 Nov 2020 14:49:47 +0100
Subject: [PATCH 004/157] make the time control consistent with other pages
---
templates/content/reports.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/templates/content/reports.php b/templates/content/reports.php
index 2ac76c8..c5d3b27 100644
--- a/templates/content/reports.php
+++ b/templates/content/reports.php
@@ -21,7 +21,7 @@