Last active
April 8, 2019 12:55
-
-
Save lucasmrdt/32aa7ca2a61c051002d2f15f28feb022 to your computer and use it in GitHub Desktop.
Revisions
-
lucasmrdt revised this gist
Apr 8, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -95,7 +95,7 @@ function proceed_time(json) { # Documentation ```json { "user_timelog": "{total}", "average_timelog": "{average}" } ``` -
lucasmrdt revised this gist
Apr 8, 2019 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -90,4 +90,12 @@ function proceed_time(json) { 'average_week': time_average_week }) } ``` # Documentation ```json { user_timelog: '{total}', average_timelog: '{average}', } ``` -
lucasmrdt revised this gist
Apr 8, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ ```https://intra.epitech.eu/user/[email protected]/netsoul/?format=json``` # Script from [Epitech Script](http://intra.epitech.eu) ```javascript function proceed_time(json) { var time_tmp = 0; -
lucasmrdt revised this gist
Apr 8, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,7 @@ ```https://intra.epitech.eu/user/[email protected]/netsoul/?format=json``` # Script **from intra.epitech.eu script** ```javascript function proceed_time(json) { var time_tmp = 0; -
lucasmrdt created this gist
Apr 8, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,92 @@ # Endpoint ```https://intra.epitech.eu/user/[email protected]/netsoul/?format=json``` # Script ```javascript function proceed_time(json) { var time_tmp = 0; var time_tmp2 = 0; var time = new Array(); var time_idle = new Array(); var time_out = new Array(); var time_out_idle = new Array(); var time_total = new Array(); var time_average = new Array(); var time_week = new Array(); var time_idle_week = new Array(); var time_out_week = new Array(); var time_out_idle_week = new Array(); var time_total_week = new Array(); var time_average_week = new Array(); var i = 0; var j = -1; var lastkey = -1; for (var key in json) { if (lastkey != -1 && (interval = parseInt((json[key][0] - json[lastkey][0]) / (24 * 3600))) > 1) for (var k = 1; k < interval; i++, k++) { time_tmp2 = time_tmp + (k * 24 * 3600 * 1000); time[i] = [time_tmp2, 0]; time_idle[i] = [time_tmp2, 0]; time_out[i] = [time_tmp2, 0]; time_out_idle[i] = [time_tmp2, 0]; time_total[i] = [time_tmp2, 0]; time_average[i] = [time_tmp2, 0]; var date = new Date(time_tmp2); if (date.getDay() == 1) { j++; time_week[j] = [time_tmp2, 0]; time_idle_week[j] = [time_tmp2, 0]; time_out_week[j] = [time_tmp2, 0]; time_out_idle_week[j] = [time_tmp2, 0]; time_total_week[j] = [time_tmp2, 0]; time_average_week[j] = [time_tmp2, 0] } } if (json[key][1] != -1) { time_tmp = ((json[key][0] + 7200) * 1000); time[i] = [time_tmp, (json[key][1] / 60 / 60)]; time_idle[i] = [time_tmp, (json[key][2] / 60 / 60)]; time_out[i] = [time_tmp, (json[key][3] / 60 / 60)]; time_out_idle[i] = [time_tmp, (json[key][4] / 60 / 60)]; time_total[i] = [time_tmp, (time[i][1] + time_idle[i][1] + time_out[i][1] + time_out_idle[i][1])]; time_average[i] = [time_tmp, json[key][5] / 60 / 60]; lastkey = key; var date = new Date(time_tmp); if (date.getDay() == 1) { j++; time_week[j] = [time_tmp, time[i][1]]; time_idle_week[j] = [time_tmp, time_idle[i][1]]; time_out_week[j] = [time_tmp, time_out[i][1]]; time_out_idle_week[j] = [time_tmp, time_out_idle[i][1]]; time_total_week[j] = [time_tmp, time_total[i][1]]; time_average_week[j] = [time_tmp, time_average[i][1]] } else if (j != -1) { time_week[j][1] += time[i][1]; time_idle_week[j][1] += time_idle[i][1]; time_out_week[j][1] += time_out[i][1]; time_out_idle_week[j][1] += time_out_idle[i][1]; time_total_week[j][1] += time_total[i][1]; time_average_week[j][1] += time_average[i][1] } i++ } else lastkey = -1 debugger; } ;return ({ 'time': time, 'idle': time_idle, 'out': time_out, 'idle_out': time_out_idle, 'total': time_total, 'average': time_average, 'time_week': time_week, 'time_idle_week': time_idle_week, 'time_out_week': time_out_week, 'time_idle_out_week': time_out_idle_week, 'total_week': time_total_week, 'average_week': time_average_week }) } ```