Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
caseine
moodle-mod_vpl
Commits
017015fe
Commit
017015fe
authored
May 28, 2021
by
Astor Bizard
Browse files
Fixed daily activity graph bug related to DST management.
parent
5f78ba40
Changes
2
Show whitespace changes
Inline
Side-by-side
locallib.php
View file @
017015fe
...
...
@@ -961,8 +961,8 @@ function vpl_get_webservice_urlbase($vpl) {
.
'&wstoken='
.
$token
.
'&id='
.
$vpl
->
get_course_module
()
->
id
.
'&wsfunction='
;
}
function
vpl_timestamp_to_mid
night
(
$timestamp
)
{
return
$timestamp
-
(
$timestamp
+
date
(
'Z'
))
%
86400
;
function
vpl_timestamp_to_mid
day
(
$timestamp
)
{
return
$timestamp
-
(
$timestamp
+
date
(
'Z'
))
%
86400
+
43200
;
}
function
vpl_get_name_fields_display
()
{
...
...
views/vpl_grapher.class.php
View file @
017015fe
...
...
@@ -337,7 +337,7 @@ class vpl_grapher {
$start
=
min
(
$start
,
$subinstance
->
datesubmitted
);
}
}
$start
=
vpl_timestamp_to_mid
night
(
$start
);
$start
=
vpl_timestamp_to_mid
day
(
$start
);
// End of time span is either module due date, either last submission date.
if
(
$this
->
vpl
->
get_instance
()
->
duedate
>
0
)
{
...
...
@@ -348,7 +348,7 @@ class vpl_grapher {
$end
=
max
(
$end
,
$subinstance
->
datesubmitted
);
}
}
$end
=
vpl_timestamp_to_mid
night
(
$end
);
$end
=
vpl_timestamp_to_mid
day
(
$end
);
// Compute per-day activity (ie. number of submissions).
$days
=
array
();
...
...
@@ -359,8 +359,11 @@ class vpl_grapher {
}
foreach
(
$this
->
submissions
as
$subinstance
)
{
$daysubmitted
=
vpl_timestamp_to_midnight
(
$subinstance
->
datesubmitted
);
$dailyactivity
[(
$daysubmitted
-
$start
)
/
86400
]
++
;
$daysubmitted
=
vpl_timestamp_to_midday
(
$subinstance
->
datesubmitted
);
$dayoffset
=
(
$daysubmitted
-
$start
)
/
86400
;
if
(
isset
(
$dailyactivity
[
$dayoffset
]))
{
$dailyactivity
[
$dayoffset
]
++
;
}
}
// Draw the graph.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment