Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
prechecker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
integration
prechecker
Commits
a576da55
Commit
a576da55
authored
Dec 12, 2017
by
Damyon Wiese
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'MDL-60861-master' of
git://github.com/ankitagarwal/moodle
parents
233c91e7
8d6b7f0c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
13 deletions
+28
-13
admin/tool/analytics/classes/output/models_list.php
admin/tool/analytics/classes/output/models_list.php
+18
-12
admin/tool/analytics/lang/en/tool_analytics.php
admin/tool/analytics/lang/en/tool_analytics.php
+2
-0
admin/tool/analytics/templates/models_list.mustache
admin/tool/analytics/templates/models_list.mustache
+3
-0
analytics/classes/model.php
analytics/classes/model.php
+4
-0
analytics/tests/model_test.php
analytics/tests/model_test.php
+1
-1
No files found.
admin/tool/analytics/classes/output/models_list.php
View file @
a576da55
...
...
@@ -119,6 +119,9 @@ class models_list implements \renderable, \templatable {
debugging
(
"The time splitting method '
{
$modeldata
->
timesplitting
}
' should include a '
{
$identifier
}
_help'
string to describe its purpose."
,
DEBUG_DEVELOPER
);
}
}
else
{
$helpicon
=
new
\help_icon
(
'timesplittingnotdefined'
,
'tool_analytics'
);
$modeldata
->
timesplittinghelp
=
$helpicon
->
export_for_template
(
$output
);
}
// Has this model generated predictions?.
...
...
@@ -207,19 +210,22 @@ class models_list implements \renderable, \templatable {
}
// Enable / disable.
if
(
$model
->
is_enabled
())
{
$action
=
'disable'
;
$text
=
get_string
(
'disable'
);
$icontype
=
't/block'
;
}
else
{
$action
=
'enable'
;
$text
=
get_string
(
'enable'
);
$icontype
=
'i/checked'
;
if
(
$model
->
is_enabled
()
||
!
empty
(
$modeldata
->
timesplitting
))
{
// If there is no timesplitting method set, the model can not be enabled.
if
(
$model
->
is_enabled
())
{
$action
=
'disable'
;
$text
=
get_string
(
'disable'
);
$icontype
=
't/block'
;
}
else
{
$action
=
'enable'
;
$text
=
get_string
(
'enable'
);
$icontype
=
'i/checked'
;
}
$urlparams
[
'action'
]
=
$action
;
$url
=
new
\moodle_url
(
'model.php'
,
$urlparams
);
$icon
=
new
\action_menu_link_secondary
(
$url
,
new
\pix_icon
(
$icontype
,
$text
),
$text
);
$actionsmenu
->
add
(
$icon
);
}
$urlparams
[
'action'
]
=
$action
;
$url
=
new
\moodle_url
(
'model.php'
,
$urlparams
);
$icon
=
new
\action_menu_link_secondary
(
$url
,
new
\pix_icon
(
$icontype
,
$text
),
$text
);
$actionsmenu
->
add
(
$icon
);
// Export training data.
if
(
!
$model
->
is_static
()
&&
$model
->
is_trained
())
{
...
...
admin/tool/analytics/lang/en/tool_analytics.php
View file @
a576da55
...
...
@@ -85,6 +85,8 @@ $string['previouspage'] = 'Previous page';
$string
[
'samestartdate'
]
=
'Current start date is good'
;
$string
[
'sameenddate'
]
=
'Current end date is good'
;
$string
[
'target'
]
=
'Target'
;
$string
[
'timesplittingnotdefined'
]
=
'Time splitting is not defined.'
;
$string
[
'timesplittingnotdefined_help'
]
=
'You need to select a time-splitting method before enabling the model.'
;
$string
[
'trainandpredictmodel'
]
=
'Training model and calculating predictions'
;
$string
[
'trainingprocessfinished'
]
=
'Training process finished'
;
$string
[
'trainingresults'
]
=
'Training results'
;
...
...
admin/tool/analytics/templates/models_list.mustache
View file @
a576da55
...
...
@@ -160,6 +160,9 @@
{{/
timesplitting
}}
{{^
timesplitting
}}
{{#
str
}}
notdefined, tool_analytics
{{/
str
}}
{{#
timesplittinghelp
}}
{{>
core
/
help_icon
}}
{{/
timesplittinghelp
}}
{{/
timesplitting
}}
</td>
<td>
...
...
analytics/classes/model.php
View file @
a576da55
...
...
@@ -1013,6 +1013,10 @@ class model {
if
(
!
$this
->
is_static
())
{
$this
->
model
->
trained
=
0
;
}
}
else
if
(
empty
(
$this
->
model
->
timesplitting
))
{
// A valid timesplitting method needs to be supplied before a model can be enabled.
throw
new
\moodle_exception
(
'invalidtimesplitting'
,
'analytics'
,
''
,
$this
->
model
->
id
);
}
// Purge pages with insights as this may change things.
...
...
analytics/tests/model_test.php
View file @
a576da55
...
...
@@ -226,7 +226,7 @@ class analytics_model_testcase extends advanced_testcase {
$this
->
model
->
mark_as_trained
();
$this
->
assertEquals
(
$originaluniqueid
,
$this
->
model
->
get_unique_id
());
$this
->
model
->
enable
();
$this
->
model
->
enable
(
'\core\analytics\time_splitting\deciles'
);
$this
->
assertEquals
(
$originaluniqueid
,
$this
->
model
->
get_unique_id
());
// Wait 1 sec so the timestamp changes.
...
...
Write
Preview
Markdown
is supported
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