Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
41372a38
authored
Jul 24, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
sessions flags fixed
parent
914e9c13
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
32 deletions
sails/src/assets/scripts/modules/student/controllers/session.js
sails/src/assets/scripts/modules/student/views/session.html
sails/src/assets/scripts/modules/student/controllers/session.js
View file @
41372a38
...
...
@@ -25,7 +25,13 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$scope
.
ws
=
$scope
.
ws
||
{};
$scope
.
actual_try
=
$scope
.
actual_try
||
{};
$scope
.
paused
=
false
;
$scope
.
flags
=
{
paused
:
false
,
showSessions
:
false
,
showLastTry
:
true
,
section
:
'new'
};
// Array with working sessions for selected instruction
$scope
.
wsessions
=
[];
...
...
@@ -33,16 +39,8 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// Array with student methods (with instructions)
$scope
.
methods
=
[];
// Visibility of the list of stored sessions
$scope
.
showSessions
=
false
;
// Initially, show the last try
$scope
.
showLastTry
=
true
;
$scope
.
selected
=
{
item
:
-
1
};
$scope
.
section
=
'new'
;
// Query to obtain an array of student methods
$http
.
get
(
config
.
backend
+
'/stu/'
+
$scope
.
studentData
.
id
+
'/methods'
)
...
...
@@ -274,7 +272,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
//
$scope
.
pause_ws
=
function
(){
if
(
!
$scope
.
sessionRunning
||
$scope
.
paused
)
if
(
!
$scope
.
sessionRunning
||
$scope
.
flags
.
paused
)
return
;
$scope
.
pauseTimer
();
...
...
@@ -301,7 +299,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
//
$scope
.
resume_ws
=
function
(){
if
(
!
$scope
.
sessionRunning
||
!
$scope
.
paused
)
if
(
!
$scope
.
sessionRunning
||
!
$scope
.
flags
.
paused
)
return
;
$scope
.
resumeTimer
();
...
...
@@ -329,23 +327,23 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
$scope
.
startTimer
=
function
(){
$scope
.
$broadcast
(
'timer-start'
);
$scope
.
paused
=
false
;
$scope
.
flags
.
paused
=
false
;
$scope
.
tryRunning
=
true
;
};
$scope
.
pauseTimer
=
function
(){
$scope
.
$broadcast
(
'timer-stop'
);
$scope
.
paused
=
true
;
$scope
.
flags
.
paused
=
true
;
};
$scope
.
resumeTimer
=
function
(){
$scope
.
$broadcast
(
'timer-resume'
);
$scope
.
paused
=
false
;
$scope
.
flags
.
paused
=
false
;
};
$scope
.
stopTimer
=
function
(){
$scope
.
$broadcast
(
'timer-stop'
);
$scope
.
paused
=
false
;
$scope
.
flags
.
paused
=
false
;
$scope
.
tryRunning
=
false
;
};
...
...
@@ -370,7 +368,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// websockets events handling (Dashboard)
//
io
.
socket
.
on
(
'update_peers'
,
function
(
data
)
{
if
(
$scope
.
ws
&&
$scope
.
sessionRunning
&&
$scope
.
actual_try
.
actions
&&
$scope
.
paused
==
false
&&
data
.
pcb_count
<
1
)
{
if
(
$scope
.
ws
&&
$scope
.
sessionRunning
&&
$scope
.
actual_try
.
actions
&&
$scope
.
flags
.
paused
==
false
&&
data
.
pcb_count
<
1
)
{
$scope
.
pause_ws
();
$scope
.
pauseTimer
();
ngToast
.
warning
({
...
...
@@ -393,7 +391,7 @@ dashboardControllers.controller('StudentSessionCtrl', function StudentSessionCtr
// as the last action, added $scope.apply() that lets angular know
// what data has updated, and refresh what needs to be refreshed.
// only events (i) from a student (and ii)when a try is opened are managed
if
(
$scope
.
ws
&&
$scope
.
actual_try
.
actions
&&
$scope
.
paused
==
false
){
if
(
$scope
.
ws
&&
$scope
.
actual_try
.
actions
&&
$scope
.
flags
.
paused
==
false
){
switch
(
data
.
action
){
case
'Add'
:
...
...
sails/src/assets/scripts/modules/student/views/session.html
View file @
41372a38
<div
class=
"panel panel-default student_tab_panel"
>
<div
class=
"panel-body"
ng-show=
"!studentData.license_expired"
>
{{flags}}
<div
class=
"form-group"
>
<div
class=
"btn-group"
>
<button
class=
"btn btn-default"
btn-radio=
"'new'"
ng-model=
"section"
>
<button
class=
"btn btn-default"
btn-radio=
"'new'"
ng-model=
"
flags.
section"
>
<span
class=
"glyphicon glyphicon-record"
></span>
{{ 'new_session' | translate }}
</button>
<button
class=
"btn btn-default"
btn-radio=
"'previous'"
ng-model=
"section"
ng-click=
"load_tries()"
ng-if=
"wsessions.length > 0"
>
<button
class=
"btn btn-default"
btn-radio=
"'previous'"
ng-model=
"
flags.
section"
ng-click=
"load_tries()"
ng-if=
"wsessions.length > 0"
>
<span
class=
"glyphicon glyphicon-transfer"
></span>
{{ 'previous_sessions' | translate }}
</button>
</div>
...
...
@@ -33,25 +33,25 @@
<div
class=
"session-controls form-horizontal"
ng-show=
"selected.item != -1"
>
<!-- show/hide sessions button -->
<div
class=
"form-group"
ng-show=
"section == 'previous'"
>
<div
class=
"form-group"
ng-show=
"
flags.
section == 'previous'"
>
<span
class=
"control-label"
>
{{ wsessions.length }} {{ 'sessions' | translate }}
</span>
<button
ng-click=
"
showSessions = !
showSessions"
class=
"btn btn-default btn-sm"
ng-disabled=
"wsessions.length == 0"
>
<div
ng-show=
"!showSessions"
>
<button
ng-click=
"
flags.showSessions = !flags.
showSessions"
class=
"btn btn-default btn-sm"
ng-disabled=
"wsessions.length == 0"
>
<div
ng-show=
"!
flags.
showSessions"
>
{{ 'show' | translate }}
<span
class=
"glyphicon glyphicon-collapse-down"
aria-hidden=
"true"
></span>
</div>
<div
ng-show=
"showSessions"
>
<div
ng-show=
"
flags.
showSessions"
>
{{ 'hide' | translate }}
<span
class=
"glyphicon glyphicon-collapse-up"
aria-hidden=
"true"
></span>
</div>
</button>
</div>
<!-- controls for session recording-->
<div
ng-show=
"studentData.pcb_count<1 && section == 'new'"
class=
"form-group"
>
<div
ng-show=
"studentData.pcb_count<1 &&
flags.
section == 'new'"
class=
"form-group"
>
<span
class=
"glyphicon glyphicon-exclamation-sign text-warning"
aria-hidden=
"true"
></span>
<span
class=
"label label-warning"
>
{{ 'warning_no_tablet_online' | translate }}
</span>
</div>
<div
class=
"input-group"
ng-show=
"selected.item != -1 && studentData.pcb_count>0 && section == 'new'"
>
<div
class=
"input-group"
ng-show=
"selected.item != -1 && studentData.pcb_count>0 &&
flags.
section == 'new'"
>
<div
class=
"btn-group pull-right"
>
<button
type=
"button"
class=
"btn btn-default btn-sm"
...
...
@@ -65,7 +65,7 @@
</button>
<button
type=
"button"
class=
"btn btn-default btn-sm"
ng-class=
"{ disabled: !sessionRunning || !paused }"
ng-class=
"{ disabled: !sessionRunning || !
flags.
paused }"
popover=
"{{ 'continue_session' | translate }}"
popover-trigger=
"mouseenter"
ng-click=
"resume_ws();"
>
...
...
@@ -73,7 +73,7 @@
</button>
<button
type=
"button"
class=
"btn btn-default btn-sm"
ng-class=
"{ disabled: !sessionRunning || paused }"
ng-class=
"{ disabled: !sessionRunning ||
flags.
paused }"
popover=
"{{ 'pause_session' | translate }}"
popover-trigger=
"mouseenter"
ng-click=
"pause_ws();"
>
...
...
@@ -113,7 +113,7 @@
</div>
<!-- running try -->
<div
id=
"actual_try"
ng-model=
"actual_try"
ng-show=
"tryRunning && section == 'new'"
>
<div
id=
"actual_try"
ng-model=
"actual_try"
ng-show=
"tryRunning &&
flags.
section == 'new'"
>
<div
class=
"try_time"
>
<timer
id=
"time_try"
class=
"color_blue"
interval=
"1000"
auto-start=
"false"
>
{{mminutes}}:{{sseconds}}
...
...
@@ -193,13 +193,13 @@
<!-- / running try -->
<!-- sessions list -->
<div
class=
"list-group pre-scrollable"
ng-show=
"
showSessions && section == 'previous' ||
showLastTry && wsessions.length > 0 || ws_recover || tryRunning"
>
<div
class=
"list-group pre-scrollable"
ng-show=
"
flags.showSessions && flags.section == 'previous' || flags.
showLastTry && wsessions.length > 0 || ws_recover || tryRunning"
>
<div
ng-repeat=
"s in wsessions | orderBy: '-begin'"
>
<!-- div class="list-group-item" ng-repeat="s in wsessions | orderBy: '-begin' | limitTo: numPerPage:(currentPage-1)*numPerPage" -->
<div
class=
"list-group-item"
ng-show=
"section == 'previous' || ws.id==s.id || ws_recover"
>
<div
class=
"list-group-item"
ng-show=
"
flags.
section == 'previous' || ws.id==s.id || ws_recover"
>
<div
ng-show=
"showLastTry && wsessions.length > 0"
>
<div
ng-show=
"
flags.
showLastTry && wsessions.length > 0"
>
<h4><strong>
{{ 'last_session' | translate }}
</strong>
: {{ studentData.current_method }}, {{ studentData.current_instruction }}
</h4>
</div>
...
...
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