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
32790c89
authored
Sep 08, 2017
by
Arturo Montejo Ráez
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'develop' into tpv
parents
e942d14e
62dcb069
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
33 deletions
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/action/SubscribeAction.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/NetService.java
android/Pictogram/tabletlibrary/tabletlibrary.iml
sails/src/api/controllers/SupervisorController.js
sails/src/api/models/Student.js
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/action/SubscribeAction.java
View file @
32790c89
...
...
@@ -13,22 +13,19 @@ import com.yottacode.pictogram.net.websockets.Room;
*/
public
class
SubscribeAction
extends
Action
{
//Picto Action types
public
static
final
String
SUBSCRIBE
=
"subscribe"
;
public
static
final
String
ACTION
=
"/stu/subscribe"
;
@Override
public
boolean
is_local_action
()
{
@Override
public
boolean
is_local_action
()
{
return
false
;
}
}
public
SubscribeAction
(
){
public
SubscribeAction
(
){
super
(
SUBSCRIBE
);
}
public
String
get_action
()
{
return
ACTION
;}
}
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/net/NetService.java
View file @
32790c89
...
...
@@ -184,9 +184,11 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
//cada restfullSynchroTimming aprox. se fuerza sincronización de vocabulario y configuración de usuario
long
now
=
new
Date
().
getTime
();
if
(
PCBcontext
.
is_user_logged
())
{
if
(
restfullSynchroTimming
>
0
&&
(
now
>=
nextRestfullSynchro
))
{
if
(
restfullSynchroTimming
>
0
&&
(
now
>=
nextRestfullSynchro
))
{
Log
.
i
(
LOG_TAG
,
"Vocabulary request."
);
PCBcontext
.
getRoom
().
connect
();
if
(!
PCBcontext
.
getRoom
().
inRoom
()){
PCBcontext
.
getRoom
().
connect
();
}
PCBcontext
.
getVocabulary
().
synchronize
();
synchronizeStudentAttributes
();
nextSynchro
(
now
+
restfullSynchroTimming
);
...
...
android/Pictogram/tabletlibrary/tabletlibrary.iml
View file @
32790c89
...
...
@@ -121,16 +121,5 @@
<orderEntry
type=
"library"
exported=
""
name=
"play-services-ads-9.2.1"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"play-services-ads-lite-9.2.1"
level=
"project"
/>
<orderEntry
type=
"module"
module-name=
"commonlibrary"
exported=
""
/>
<orderEntry
type=
"library"
exported=
""
name=
"okhttp-ws-2.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"socket.io-client-0.5.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"okhttp-2.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"support-annotations-23.0.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"okio-1.3.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"gson-2.3"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"engine.io-client-0.5.0"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
name=
"appcompat-v7-21.0.3"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"hamcrest-core-1.3"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"junit-4.12"
level=
"project"
/>
<orderEntry
type=
"library"
exported=
""
scope=
"TEST"
name=
"json-20090211"
level=
"project"
/>
</component>
</module>
\ No newline at end of file
sails/src/api/controllers/SupervisorController.js
View file @
32790c89
...
...
@@ -551,18 +551,20 @@ module.exports = {
*
*/
link_supervisor
:
function
(
req
,
res
)
{
if
(
!
req
.
params
.
id_off
||
!
req
.
params
.
id_sup
)
var
params
=
req
.
allParams
();
if
(
!
params
.
id_off
||
!
params
.
id_sup
)
return
res
.
badRequest
();
if
(
req
.
params
.
id_off
==
req
.
params
.
id_sup
)
if
(
params
.
id_off
==
params
.
id_sup
)
return
res
.
badRequest
(
"Link to yourself is not allowed"
);
// Check that both ids are valid
Supervisor
.
findOne
(
req
.
params
.
id_sup
)
Supervisor
.
findOne
(
params
.
id_sup
)
.
then
((
sup
)
=>
{
if
(
!
sup
)
throw
new
Error
(
"Supervisor not found"
);
return
[
sup
,
Supervisor
.
findOne
(
req
.
params
.
id_off
)];
return
[
sup
,
Supervisor
.
findOne
(
params
.
id_off
)];
})
.
spread
((
sup
,
off
)
=>
{
if
(
!
off
)
...
...
@@ -601,20 +603,22 @@ module.exports = {
*
*/
unlink_supervisor
:
function
(
req
,
res
)
{
if
(
!
req
.
params
.
id_off
||
!
req
.
params
.
id_sup
)
var
params
=
req
.
allParams
();
if
(
!
params
.
id_off
||
!
params
.
id_sup
)
return
res
.
badRequest
();
// Check that both ids are valid
Supervisor
.
findOne
(
req
.
params
.
id_sup
)
Supervisor
.
findOne
(
params
.
id_sup
)
.
then
((
s
)
=>
{
if
(
!
s
)
throw
new
Error
(
"Supervisor not found"
);
return
Supervisor
.
findOne
(
req
.
params
.
id_off
);
return
Supervisor
.
findOne
(
params
.
id_off
);
})
.
then
((
s
)
=>
{
if
(
!
s
)
throw
new
Error
(
"Supervisor not found"
);
return
SupOff
.
destroy
({
supervisor
:
req
.
params
.
id_sup
,
office
:
req
.
params
.
id_off
});
return
SupOff
.
destroy
({
supervisor
:
params
.
id_sup
,
office
:
params
.
id_off
});
})
.
then
((
sos
)
=>
{
if
(
!
sos
)
...
...
sails/src/api/models/Student.js
View file @
32790c89
...
...
@@ -127,7 +127,7 @@ module.exports = {
else
{
student
.
current_method
=
"no_method"
;
student
.
current_instruction
=
"no_instruction"
;
}
}
delete
student
.
password
;
return
student
;
...
...
@@ -321,7 +321,7 @@ module.exports = {
if
(
!
supOffs
||
supOffs
.
length
==
0
)
{
// if we get here, only the requester being directly related to the
// student is valid
var
supIdx
=
stuSups
.
findIndex
(
x
=>
x
.
supervisor
.
id
==
id_sup
);
var
supIdx
=
stuSups
.
findIndex
(
x
=>
x
.
supervisor
&&
x
.
supervisor
.
id
==
id_sup
);
if
(
supIdx
>=
0
)
return
callback
(
null
,
[
stuSups
[
supIdx
].
supervisor
]);
throw
new
Error
(
"No supervisors related"
);
...
...
@@ -329,12 +329,17 @@ module.exports = {
// filter null entries and map them to the supervisor object
var
ss
=
_
.
compact
(
_
.
compact
(
stuSups
).
map
(
x
=>
x
.
supervisor
));
var
so
=
_
.
compact
(
_
.
compact
(
supOffs
).
map
(
x
=>
x
.
supervisor
));
var
ss
=
_
.
compact
(
_
.
compact
(
stuSups
).
map
(
x
=>
x
.
supervisor
));
// supervisors linked to student
var
so
=
_
.
compact
(
_
.
compact
(
supOffs
).
map
(
x
=>
x
.
supervisor
));
// supervisors linked to office
// filter from the second list those found in the first list
var
sups
=
so
.
filter
(
a
=>
ss
.
findIndex
(
b
=>
b
.
id
==
a
.
id
)
>=
0
);
return
[
sups
,
Supervisor
.
find
(
id_sup
)];
})
.
spread
((
sups
,
me
)
=>
{
// The requester is an office, so it has to be appended to the list of valid supervisors
sups
.
push
(
me
[
0
]);
return
callback
(
null
,
sups
);
})
.
catch
((
err
)
=>
{
...
...
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