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
0bbb3905
authored
Aug 30, 2016
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Solved issues #546 and #548
parent
a344738a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
104 additions
and
120 deletions
android/Pictogram/build.gradle
android/Pictogram/commonlibrary/commonlibrary.iml
android/Pictogram/gradle/wrapper/gradle-wrapper.properties
android/Pictogram/tablet/build.gradle
android/Pictogram/tablet/tablet.iml
android/Pictogram/watch/watch.iml
sails/src/api/controllers/MethodController.js
sails/src/api/controllers/WorkingSessionController.js
sails/src/assets/app/i18n/en-gb.json
sails/src/assets/app/i18n/es-es.json
sails/src/assets/app/index.html
sails/src/assets/scripts/modules/student/controllers/instructions.js
sails/src/assets/scripts/modules/student/views/header.html
sails/src/config/sockets.js
android/Pictogram/build.gradle
View file @
0bbb3905
...
...
@@ -5,7 +5,7 @@ buildscript {
jcenter
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.1.
2
'
classpath
'com.android.tools.build:gradle:2.1.
3
'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
...
...
android/Pictogram/commonlibrary/commonlibrary.iml
View file @
0bbb3905
...
...
@@ -128,6 +128,5 @@
<orderEntry
type=
"library"
exported=
""
name=
"ion-2.1.8"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"json-20090211"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-ads-lite-9.2.1"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"android-android-24"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
android/Pictogram/gradle/wrapper/gradle-wrapper.properties
View file @
0bbb3905
#Mon
Jun 06 22:38:3
9 CEST 2016
#Mon
Aug 29 01:05:0
9 CEST 2016
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-2.1
0
-all.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-2.1
4.1
-all.zip
android/Pictogram/tablet/build.gradle
View file @
0bbb3905
...
...
@@ -22,7 +22,7 @@ android {
resValue
"string"
,
"server"
,
"https://127.0.0.1:9944"
}
LocalFlavor
{
resValue
"string"
,
"server"
,
"https://192.168.1.3
7
:1337"
resValue
"string"
,
"server"
,
"https://192.168.1.3
6
:1337"
}
DevFlavor
{
resValue
"string"
,
"server"
,
"https://dev.yottacode.com"
...
...
android/Pictogram/tablet/tablet.iml
View file @
0bbb3905
This diff is collapsed.
Click to expand it.
android/Pictogram/watch/watch.iml
View file @
0bbb3905
This diff is collapsed.
Click to expand it.
sails/src/api/controllers/MethodController.js
View file @
0bbb3905
...
...
@@ -35,84 +35,65 @@ module.exports = {
create
:
function
(
req
,
res
)
{
var
params
=
req
.
allParams
();
if
(
!
params
.
id_mmethod
)
return
res
.
json
(
500
,
{
error
:
"No meta method defined"
}
);
if
(
!
params
.
id_stu
)
return
res
.
json
(
500
,
{
error
:
"No student defined"
}
);
if
(
!
params
.
id_mmethod
)
return
res
.
badRequest
(
"No meta method defined"
);
if
(
!
params
.
id_stu
)
return
res
.
badRequest
(
"No student defined"
);
// Find meta method
MetaMethod
.
findOne
({
id
:
params
.
id_mmethod
}).
exec
(
function
(
err
,
mmethod
)
{
if
(
err
||
!
mmethod
){
sails
.
log
.
debug
(
"Finding meta method: "
+
err
);
return
;
}
sails
.
log
.
debug
(
"Meta method found:"
+
mmethod
);
// Create new method by meta method
Method
.
create
({
name
:
mmethod
.
name
,
description
:
mmethod
.
description
,
student
:
params
.
id_stu
}).
exec
(
function
(
err
,
created
)
{
if
(
err
)
{
sails
.
log
.
debug
(
"Creating new method: "
+
err
);
return
res
.
json
(
500
,
{
error
:
'Method not created'
});
}
if
(
created
)
{
// Find meta instructions associated to meta method
MetaInstruction
.
find
({
id_met
:
params
.
id_mmethod
}).
exec
(
function
(
err
,
minstructions
)
{
if
(
err
||
!
minstructions
||
minstructions
.
length
==
0
){
sails
.
log
.
debug
(
"Finding meta instructions of a meta method: "
+
err
);
return
;
}
sails
.
log
.
debug
(
"Meta instructions found: "
+
JSON
.
stringify
(
minstructions
));
var
l_ins
=
[];
// Every meta instruction is going to be created in 'Instruction'
// with .eachSeries the order of resulting array will be equal
// to the original array
async
.
eachSeries
(
minstructions
,
function
(
mins
,
callback
)
{
sails
.
log
.
debug
(
"Loop adding meta instruction: "
+
mins
.
name
+
" to method "
+
created
.
id
);
Instruction
.
create
({
method
:
created
.
id
,
name
:
mins
.
name
,
objective
:
mins
.
objective
}).
exec
(
function
(
err
,
added
){
if
(
err
)
sails
.
log
.
debug
(
"Instruction.create: "
+
err
);
if
(
added
){
l_ins
.
push
(
added
);
sails
.
log
.
debug
(
"Instruction "
+
added
.
name
+
" added to method "
+
created
.
id
);
}
callback
();
});
// Finish function when each callback is done
// Optionaly it can be passed and err parameter
},
function
(
err
){
if
(
err
)
{
// One of the iterations produced an error.
// All processing will now stop.
}
else
{
return
res
.
json
({
"name"
:
created
.
name
,
"description"
:
created
.
description
,
"id"
:
created
.
id
,
"student"
:
created
.
id_stu
,
"instructions"
:
l_ins
});
}
});
MetaMethod
.
findOne
({
id
:
params
.
id_mmethod
})
.
then
(
mmethod
=>
{
if
(
!
mmethod
)
throw
new
Error
(
"Meta method not found"
);
// Create new method by meta method
return
Method
.
create
(
{
name
:
mmethod
.
name
,
description
:
mmethod
.
description
,
student
:
params
.
id_stu
})
.
then
(
created
=>
created
)
.
fail
(
err
=>
{
throw
err
});
})
.
then
(
created
=>
{
// Find meta instructions associated to meta method
MetaInstruction
.
find
({
id_met
:
params
.
id_mmethod
})
.
then
(
minstructions
=>
{
if
(
!
minstructions
)
minstructions
=
[];
var
l_ins
=
[];
// Every meta instruction is going to be created in 'Instruction'
// with .eachSeries the order of resulting array will be equal
// to the original array
async
.
eachSeries
(
minstructions
,
function
(
mins
,
next
)
{
Instruction
.
create
({
method
:
created
.
id
,
name
:
mins
.
name
,
objective
:
mins
.
objective
})
.
then
(
added
=>
{
l_ins
.
push
(
added
);
sails
.
log
.
debug
(
"Instruction "
+
added
.
name
+
" added to method "
+
created
.
id
);
})
.
fail
(
err
=>
{
throw
err
})
.
done
(()
=>
{
next
()});
},
function
(
err
,
results
)
{
if
(
err
)
throw
new
Error
(
"Error while looping through instructions"
);
return
res
.
ok
({
"name"
:
created
.
name
,
"description"
:
created
.
description
,
"id"
:
created
.
id
,
"student"
:
created
.
id_stu
,
"instructions"
:
l_ins
});
}
});
});
})
.
fail
(
err
=>
{
throw
err
});
})
.
fail
(
err
=>
{
return
res
.
badRequest
(
err
);
});
},
...
...
sails/src/api/controllers/WorkingSessionController.js
View file @
0bbb3905
...
...
@@ -55,7 +55,7 @@ module.exports = {
create
:
function
(
req
,
res
)
{
var
params
=
req
.
allParams
();
console
.
log
(
JSON
.
stringify
(
params
));
sails
.
debug
.
log
(
JSON
.
stringify
(
params
));
if
(
!
params
.
id_sup
)
res
.
badRequest
(
"No supervisor defined"
);
if
(
!
params
.
id_ins
)
res
.
badRequest
(
"No instruction defined"
);
...
...
@@ -66,7 +66,7 @@ module.exports = {
data
.
supervisor
=
params
.
id_sup
;
data
.
instruction
=
params
.
id_ins
;
data
.
description
=
params
.
desc
;
console
.
log
(
"BEGIN "
+
params
.
begin
);
sails
.
debug
.
log
(
"BEGIN "
+
params
.
begin
);
data
.
begin
=
params
.
begin
;
// data comes in ISO format
StuOpenTry
.
findOne
({
or
:
[
// pending open try?
...
...
sails/src/assets/app/i18n/en-gb.json
View file @
0bbb3905
...
...
@@ -218,6 +218,7 @@
"serial_list"
:
"Free serial numbers"
,
"serial_not_created"
:
"Serial number couldn't be created"
,
"session"
:
"Session"
,
"sessions"
:
"Sessions"
,
"session_mean_length"
:
"Session mean length: {{hours}} hours"
,
"session_notes"
:
"Session notes"
,
"sessions"
:
"Sessions"
,
...
...
@@ -260,6 +261,7 @@
"surname"
:
"Surname"
,
"tag_deleted"
:
"Tag deleted"
,
"tape_background"
:
"Tape background"
,
"template_deleted"
:
"Template deleted"
,
"time_instruction_method"
:
"Time instructions of method"
,
"time_hours"
:
"Time: {{hours}} hours"
,
"time_sessions_per_days"
:
"Time of sessions per days in"
,
...
...
sails/src/assets/app/i18n/es-es.json
View file @
0bbb3905
...
...
@@ -219,6 +219,7 @@
"serial_list"
:
"Números de serie libres"
,
"serial_not_created"
:
"No se ha podido crear el número de serie"
,
"session"
:
"Sesión"
,
"sessions"
:
"Sesiones"
,
"session_mean_length"
:
"Duración media de sesión: {{hours}} horas"
,
"session_notes"
:
"Notas de sesión"
,
"sessions"
:
"Sesiones"
,
...
...
@@ -261,6 +262,7 @@
"surname"
:
"Apellidos"
,
"tag_deleted"
:
"Etiqueta borrada"
,
"tape_background"
:
"Fondo de la cinta"
,
"template_deleted"
:
"Plantilla eliminada"
,
"time_hours"
:
"Tiempo: {{hours}} horas"
,
"time_instruction_method"
:
"Tiempo instrucciones del método"
,
"time_sessions_per_days"
:
"Tiempo de sesiones por días en"
,
...
...
sails/src/assets/app/index.html
View file @
0bbb3905
...
...
@@ -5,6 +5,7 @@
<title>
Pictogram Dashboard
</title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, maximum-scale=1"
>
<link
rel=
"stylesheet"
href=
"css/main.css"
>
<link
rel=
"icon"
href=
"img/logo_pictogram.png"
type=
'image/png'
>
<script
src=
"js/libs.js"
></script>
<script
src=
"js/main.js"
></script>
</head>
...
...
sails/src/assets/scripts/modules/student/controllers/instructions.js
View file @
0bbb3905
...
...
@@ -89,7 +89,7 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
console
.
log
(
"Error from API: "
+
data
.
error
);
});
}
else
{
}
else
{
// Add method from templates
$http
.
post
(
config
.
backend
+
'/method'
,
{
...
...
@@ -113,32 +113,32 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
// Delete template
$scope
.
delete_template
=
function
(){
var
deleteTemp
=
$window
.
confirm
(
'Are you absolutely sure you want to delete?'
);
// If the method template is property of the supervisor
if
(
deleteTemp
&&
$scope
.
method_selected
.
supervisor
==
$scope
.
user
.
id
){
$http
.
delete
(
config
.
backend
+
'/method/template/'
+
$scope
.
method_selected
.
id
)
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
'Delete Method Template and its Instructions'
);
var
myToastMsg
=
ngToast
.
success
({
content
:
'Eliminado método de plantillas'
,
timeout
:
6000
// By default 4000
});
// Delete in select
for
(
var
i
=
0
;
i
<
$scope
.
methods_available
.
length
;
i
++
)
{
if
(
$scope
.
methods_available
[
i
].
id
==
$scope
.
method_selected
.
id
){
$scope
.
methods_available
.
splice
(
i
,
1
);
$scope
.
method_selected
=
null
;
break
;
}
$translate
(
'confirmation'
).
then
(
function
(
translation
)
{
newconfirm
(
translation
).
then
(
function
()
{
if
(
$scope
.
method_selected
.
supervisor
==
$scope
.
user
.
id
){
$http
.
delete
(
config
.
backend
+
'/method/template/'
+
$scope
.
method_selected
.
id
)
.
success
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
'Delete Method Template and its Instructions'
);
$translate
(
'template_deleted'
).
then
(
t
=>
{
ngToast
.
success
({
content
:
t
})});
// Delete in select
for
(
var
i
=
0
;
i
<
$scope
.
methods_available
.
length
;
i
++
)
{
if
(
$scope
.
methods_available
[
i
].
id
==
$scope
.
method_selected
.
id
){
$scope
.
methods_available
.
splice
(
i
,
1
);
$scope
.
method_selected
=
null
;
break
;
}
}
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
});
}
})
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
});
}
});
});
};
// Update method
...
...
@@ -217,13 +217,13 @@ dashboardControllers.controller('StudentInstructionsCtrl', function StudentInstr
.
error
(
function
(
data
,
status
,
headers
,
config
)
{
console
.
log
(
"Error from API: "
+
data
.
error
);
var
myToastMsg
=
$translate
(
'cannot_delete_method'
).
then
(
function
(
translation
)
{
// Show message
ngToast
.
warning
({
content
:
translation
,
timeout
:
6000
// By default 4000
// Show message
ngToast
.
warning
({
content
:
translation
,
timeout
:
6000
// By default 4000
});
});
});
});
});
});
};
...
...
sails/src/assets/scripts/modules/student/views/header.html
View file @
0bbb3905
...
...
@@ -36,7 +36,7 @@
<a
href=
"/app/#/student/{{studentData.id}}/instructions"
ng-click=
"nav.tab = 'instructions'"
><span
class=
"glyphicon glyphicon-tasks"
aria-hidden=
"true"
></span>
{{ 'instructions' | translate }}
</a>
</li>
<li
role=
"presentation"
ng-class=
"{'active' : nav.tab == 'session'}"
ng-if=
"studentData.supervision == 2"
>
<a
href=
"/app/#/student/{{studentData.id}}/session"
ng-click=
"nav.tab = 'session'"
><span
class=
"glyphicon glyphicon-transfer"
aria-hidden=
"true"
></span>
{{ 'session' | translate }}
</a>
<a
href=
"/app/#/student/{{studentData.id}}/session"
ng-click=
"nav.tab = 'session'"
><span
class=
"glyphicon glyphicon-transfer"
aria-hidden=
"true"
></span>
{{ 'session
s
' | translate }}
</a>
</li>
<li
role=
"presentation"
ng-class=
"{'active' : nav.tab == 'reports'}"
ng-if=
"studentData.supervision != 1"
>
<a
href=
"/app/#/student/{{studentData.id}}/reports"
ng-click=
"nav.tab = 'reports'"
><span
class=
"glyphicon glyphicon-file"
aria-hidden=
"true"
></span>
{{ 'reports' | translate }}
</a>
...
...
sails/src/config/sockets.js
View file @
0bbb3905
...
...
@@ -12,7 +12,7 @@
*/
module
.
exports
.
sockets
=
{
pingTimeout
:
20000
,
// set timeout to 20 secs
/***************************************************************************
...
...
@@ -38,7 +38,7 @@ afterDisconnect: function (session, socket, cb) {
var
rooms
=
sails
.
hooks
.
rooms
.
getRoom
(
socket
);
if
(
rooms
)
for
(
var
i
=
0
;
i
<
rooms
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
rooms
.
length
;
i
++
)
{
console
.
log
(
"Unubscribed room in socket afterDisconnect: "
+
rooms
[
i
]);
sails
.
hooks
.
rooms
.
unsubscribeFromRoom
(
rooms
[
i
],
socket
);
}
...
...
@@ -54,12 +54,12 @@ afterDisconnect: function (session, socket, cb) {
* flashsockets by adding 'flashsocket' to this list: *
* *
***************************************************************************/
transports
:
[
//
transports: [
// 'websocket'
// 'htmlfile',
// 'xhr-polling'
'polling'
]
//
'polling'
//
]
/***************************************************************************
* *
...
...
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