Commit 7511ebdf by Fernando Martínez Santiago

Merge branch 'master' of http://scm.ujaen.es/softuno/pictogram

parents 0481ccc2 8daa337e
android
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4"> <module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/../../android/gen" />
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/../../android/gen" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/../../android/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/../../android/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/../../android/assets" />
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/../../android/libs" />
<option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/../../android/proguard_logs" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true"> <component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$">
<orderEntry type="inheritedJdk" /> <sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
</content>
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
<component name="CopyrightManager">
<settings default="" />
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="Android API 21 Platform" project-jdk-type="Android SDK" />
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/android.iml" filepath="$PROJECT_DIR$/.idea/android.iml" />
</modules>
</component>
</project>
<component name="DependencyValidationManager">
<state>
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
</state>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
\ No newline at end of file
...@@ -55,4 +55,4 @@ dependencies { ...@@ -55,4 +55,4 @@ dependencies {
compile 'com.github.nkzawa:socket.io-client:0.5.0' compile 'com.github.nkzawa:socket.io-client:0.5.0'
compile 'com.koushikdutta.async:androidasync:2.+' compile 'com.koushikdutta.async:androidasync:2.+'
compile 'com.android.support:support-v4:21.0.+' compile 'com.android.support:support-v4:21.0.+'
} }
\ No newline at end of file
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
android:name=".gui.MainActivity" android:name=".gui.MainActivity"
android:label="@string/app_name" android:label="@string/app_name"
android:screenOrientation="landscape" > android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity> </activity>
<activity <activity
android:name=".gui.SerialActivity" android:name=".gui.SerialActivity"
...@@ -65,7 +68,6 @@ ...@@ -65,7 +68,6 @@
android:screenOrientation="portrait" > android:screenOrientation="portrait" >
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
......
...@@ -37,22 +37,21 @@ public class Action { ...@@ -37,22 +37,21 @@ public class Action {
public String get_type() { return this.type;} public String get_type() { return this.type;}
protected JSONObject get_json() { protected JSONObject get_json() {
final String param_id_stu="student"; final String param_id_stu="id_stu";
final String param_id_sup="supervisor"; final String param_id_sup="id_sup";
final String param_id_dev="device"; final String param_id_dev="device";
final String param_timestamp="timestamp"; final String param_timestamp="timestamp";
final Date currentTime = new Date(); final Date currentTime = new Date();
SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); SimpleDateFormat datetime = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
try { try {
JSONObject jsonObject = new JSONObject() JSONObject jsonObject = new JSONObject()
// .put(param_id_stu, PCBcontext.getPcbdb().getCurrentUser().get_id_stu()) .put(param_id_stu, PCBcontext.getPcbdb().getCurrentUser().get_id_stu())
.put("id_stu", PCBcontext.getPcbdb().getCurrentUser().get_id_stu()) //ELIMINAR CUANDO SE UNIFIQUE CRITERIO .put(param_timestamp, datetime.format(currentTime));
.put(param_timestamp, datetime.format(currentTime))
.put("id_dev", PCBcontext.getDevice().getDeviceID()); //ELIMINAR CUANDO SE UNIFIQUE CRITERIO
//.put(param_id_dev, PCBcontext.getDevice().getDeviceID());
if (PCBcontext.getPcbdb().getCurrentUser().has_supervisor()) if (PCBcontext.getPcbdb().getCurrentUser().has_supervisor())
jsonObject.put(param_id_sup,PCBcontext.getPcbdb().getCurrentUser().get_id_sup()); jsonObject.put(param_id_sup,PCBcontext.getPcbdb().getCurrentUser().get_id_sup());
//TODO Decidir qué almacenar con DEVICE
//if (PCBcontext.getDevice().getDeviceID()!=null)
// jsonObject.put(param_id_dev, PCBcontext.getDevice().getDeviceID());
return jsonObject; return jsonObject;
}catch(JSONException e) { }catch(JSONException e) {
......
...@@ -50,7 +50,7 @@ public class ActionLog implements iRestapiListener { ...@@ -50,7 +50,7 @@ public class ActionLog implements iRestapiListener {
actions= "{ actions:[" + actions.substring(1) + "] }"; actions= "{ actions:[" + actions.substring(1) + "] }";
params.put("actions",actions); params.put("actions",actions);
Log.i(this.getClass().getCanonicalName()," Sending batch actions: "+actions); Log.i(this.getClass().getCanonicalName()," Sending batch actions: "+actions);
PCBcontext.getRestapiWrapper().ask("/stu/" + PCBcontext.getPcbdb().getCurrentUser().get_id_sup() + "/actions_batch", params, "post", this); PCBcontext.getRestapiWrapper().ask("/stu/" + PCBcontext.getPcbdb().getCurrentUser().get_id_stu() + "/actions_batch", params, "post", this);
params.clear(); params.clear();
} }
} }
......
...@@ -119,11 +119,13 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -119,11 +119,13 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
PCBcontext.getPcbdb().addPicto(pic); PCBcontext.getPcbdb().addPicto(pic);
} }
private boolean empty_category(int pic_cat) {return this.pictos.get(pic_cat)==null;}
private int find_picto_index(int pic_cat, int pic_id) { private int find_picto_index(int pic_cat, int pic_id) {
LinkedList<Picto> pictos_cat=this.pictos.get(pic_cat); LinkedList<Picto> pictos_cat=this.pictos.get(pic_cat);
int index=-1; int index=-1;
for (int i=0; i<pictos_cat.size() && index==-1; i++) for (int i=0; i<pictos_cat.size() && index==-1; i++)
if (pictos_cat.get(i).get_id()==pic_id) index=i; if (pictos_cat.get(i).get_id()==pic_id) index=i;
return index; return index;
} }
/** /**
...@@ -132,8 +134,13 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -132,8 +134,13 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
*/ */
public void removePicto(int pic_cat, int pic_id){ public void removePicto(int pic_cat, int pic_id){
LinkedList<Picto> pictos_cat=this.pictos.get(pic_cat); LinkedList<Picto> pictos_cat=this.pictos.get(pic_cat);
pictos_cat.remove(find_picto_index(pic_cat, pic_id)); int index = find_picto_index(pic_cat, pic_id);
PCBcontext.getPcbdb().deletePicto(pic_id); if (index>=0) { //puede ocurrir que se intente borrar un pictograma dos veces
pictos_cat.remove();
PCBcontext.getPcbdb().deletePicto(pic_id);
}
else
Log.i(this.getClass().getCanonicalName(),"Trying to delete an unregistered picto:"+pic_id+" cat:"+pic_cat);
} }
/** /**
...@@ -144,10 +151,14 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -144,10 +151,14 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
*/ */
public void modifyAttsPicto(int pic_cat, int pic_id, JSONObject attrs) { public void modifyAttsPicto(int pic_cat, int pic_id, JSONObject attrs) {
int index=find_picto_index(pic_cat, pic_id);
Picto picto=this.pictos.get(pic_cat).get(find_picto_index(pic_cat, pic_id)); if (index>=0) { //puede ocurrir que se intente modificar un pictograma que fue borrado
picto.set_json_attr(attrs); Picto picto = this.pictos.get(pic_cat).get(index);
PCBcontext.getPcbdb().modifyPicto(pic_id, attrs.toString()); picto.set_json_attr(attrs);
PCBcontext.getPcbdb().modifyPicto(pic_id, attrs.toString());
}
else
Log.i(this.getClass().getCanonicalName(),"Trying to modify an unregistered picto:"+pic_id+" cat:"+pic_cat);
} }
/** /**
...@@ -190,7 +201,10 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -190,7 +201,10 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
* @return * @return
*/ */
private boolean isVisibleCategory(int id) { private boolean isVisibleCategory(int id) {
if (empty_category(id)) return false;
boolean visible=false; boolean visible=false;
for (Picto picto : this.pictos.get(id)) { for (Picto picto : this.pictos.get(id)) {
visible=picto.is_enabled(); visible=picto.is_enabled();
if (visible) break; if (visible) break;
...@@ -283,20 +297,15 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular ...@@ -283,20 +297,15 @@ public class Vocabulary implements Iterable<Picto>, iRestapiListener, iVocabular
public void change(action action, int picto_cat, int picto_id, JSONObject args) { public void change(action action, int picto_cat, int picto_id, JSONObject args) {
switch (action) { switch (action) {
case delete: { case delete: {
Log.d("Vocabulary.java", "Entra en el case delete. Picto cat: " + picto_cat + " y picto_id: " + picto_id);
removePicto(picto_cat, picto_id); removePicto(picto_cat, picto_id);
break; break;
} }
case update:{ case update:{
Log.d("Vocabulary.java", "Entra en el case update. Picto cat: " + picto_cat + " y picto_id: " + picto_id);
modifyAttsPicto(picto_cat, picto_id, args); modifyAttsPicto(picto_cat, picto_id, args);
break; break;
} }
case add:{ case add:{
Log.d("Vocabulary.java", "Entra en el case add. Picto_id: " + picto_id);
try{ try{
String text= args.getJSONObject("expression").getString("text"); String text= args.getJSONObject("expression").getString("text");
String uri=args.getJSONObject("picto").getString("uri"); String uri=args.getJSONObject("picto").getString("uri");
......
package com.yottacode.pictogram.grammar; import android.util.Log; import com.github.nkzawa.emitter.Emitter; import org.json.JSONException;import org.json.JSONObject; import com.yottacode.pictogram.dao.Picto;import com.yottacode.pictogram.action.Room; /** * Websocket Vocabulary Room based on Room * @author Fernando Martinez Santiago * @version 1.0 */public class VocabularyTalk implements Emitter.Listener { private static final String URL ="vocabulary"; private Room room; private Vocabulary vocabulary; iVocabularyListener listeners[]; public VocabularyTalk(Room room, iVocabularyListener listeners[]) { this.room = room; this.room.listen(URL, this); this.listeners=listeners; } private void emit(iVocabularyListener.action action, int picto_cat, int picto_id, JSONObject args) { for (iVocabularyListener listener: this.listeners) listener.change(action, picto_cat, picto_id, args); } @Override public void call(Object... args) { final String param_action="action"; final String param_attributes="attributes"; final String param_picto="picto"; final String param_picto_cat="id_cat"; final String action_update="update"; final String action_add="add"; final String action_delete="delete"; JSONObject msg = (JSONObject) args[0]; try { Log.d(this.getClass().getName(), "Received something"); String action = msg.getString(param_action).toLowerCase(); Log.d(this.getClass().getName(), "- Action: " + action); JSONObject picto= msg.getJSONObject(param_attributes).getJSONObject(param_picto); Log.d(this.getClass().getName(), "- Picto: " + picto.toString()); JSONObject attrs_picto = picto.getJSONObject(param_attributes); Log.d(this.getClass().getName(), "- Attrs: " + attrs_picto.toString()); // Update a picto // Perfect in categories // In a picto, it refresh the vocabulary and open the main categories if (action.equals(action_update)) { int picto_id = picto.getInt(param_picto); Log.d(this.getClass().getName(), "- Picto ID: " + picto_id); int picto_cat = attrs_picto.optInt(param_picto_cat, Picto.NO_CATEGORY); Log.d(this.getClass().getName(), "- Picto Cat: " + picto_cat); // TODO Here proccess the events recieved via websocket by the dashboard Log.d(this.getClass().getName(), "Received message '" + action + "' for picto " + picto_id + " (cat " + picto_cat + ")"); //Hashtable<iVocabularyListener.arg, Object> atts = new Hashtable<>(1); //atts.put(iVocabularyListener.arg.attributes, attrs_picto); this.emit(iVocabularyListener.action.update, picto_cat, picto_id, attrs_picto); } // Add a picto // The dashboard interts it in hide form and when the user modify the view property // the activity launch an error and go back to the StudentFragment else if (action.equals(action_add)) { int picto_id = picto.getJSONObject("picto").getInt("id"); Log.d(this.getClass().getName(), "- Picto ID: " + picto_id); int picto_cat = attrs_picto.optInt(param_picto_cat, Picto.NO_CATEGORY); Log.d(this.getClass().getName(), "- Picto Cat: " + picto_cat); // TODO Here proccess the events recieved via websocket by the dashboard Log.d(this.getClass().getName(), "Received message '" + action + "' for picto " + picto_id + " (cat " + picto_cat + ")"); final String jexpression="expression"; final String jexpression_text="text"; final String juri="uri"; String text= picto.getJSONObject(jexpression).getString(jexpression_text); String uri=picto.getJSONObject("picto").getString(juri); //Hashtable<iVocabularyListener.arg,Object> atts=new Hashtable<>(3); //atts.put(iVocabularyListener.arg.url,uri); //atts.put(iVocabularyListener.arg.expression,text); //atts.put(iVocabularyListener.arg.attributes, attrs_picto); this.emit(iVocabularyListener.action.add, picto_cat, picto_id, picto); } // Delete a picto // Exit the activity going to StudentFragment else if (action.equals(action_delete)) { int picto_id = picto.getInt(param_picto); Log.d(this.getClass().getName(), "- Picto ID: " + picto_id); int picto_cat = attrs_picto.optInt(param_picto_cat, Picto.NO_CATEGORY); Log.d(this.getClass().getName(), "- Picto Cat: " + picto_cat); // TODO Here proccess the events recieved via websocket by the dashboard Log.d(this.getClass().getName(), "Received message '" + action + "' for picto " + picto_id + " (cat " + picto_cat + ")"); this.emit(iVocabularyListener.action.delete, picto_cat, picto_id, null); } } catch (JSONException e) { Log.e(this.getClass().getCanonicalName(), e.getClass().getCanonicalName() + "--" + e); // System.exit(-1); } } } package com.yottacode.pictogram.grammar; import android.util.Log; import com.github.nkzawa.emitter.Emitter; import org.json.JSONException;import org.json.JSONObject; import com.yottacode.pictogram.dao.Picto;import com.yottacode.pictogram.action.Room; /** * Websocket Vocabulary Room based on Room * @author Fernando Martinez Santiago * @version 1.0 */public class VocabularyTalk implements Emitter.Listener { private static final String URL ="vocabulary"; private Room room; private Vocabulary vocabulary; iVocabularyListener listeners[]; public VocabularyTalk(Room room, iVocabularyListener listeners[]) { this.room = room; this.room.listen(URL, this); this.listeners=listeners; } private void emit(iVocabularyListener.action action, int picto_cat, int picto_id, JSONObject args) { for (iVocabularyListener listener: this.listeners) listener.change(action, picto_cat, picto_id, args); } @Override public void call(Object... args) { final String param_action="action"; final String param_attributes="attributes"; final String param_picto="picto"; final String param_picto_cat="id_cat"; final String action_update="update"; final String action_add="add"; final String action_delete="delete"; JSONObject msg = (JSONObject) args[0]; try { String action = msg.getString(param_action).toLowerCase(); JSONObject picto= msg.getJSONObject(param_attributes).getJSONObject(param_picto); JSONObject attrs_picto = picto.getJSONObject(param_attributes); int picto_id = picto.getInt(param_picto); int picto_cat = attrs_picto.optInt(param_picto_cat, Picto.NO_CATEGORY); Log.d(this.getClass().getName(), "Received message '" + action + "' to picto " + picto_id + " (cat " + picto_cat + ", attrs: "+attrs_picto); this.emit( action.equals(action_update) ? iVocabularyListener.action.update : action.equals(action_add) ? iVocabularyListener.action.add : iVocabularyListener.action.delete , picto_cat, picto_id, attrs_picto); } catch (JSONException e) { Log.e(this.getClass().getCanonicalName(), e.getClass().getCanonicalName() + "--" + e); } }}
\ No newline at end of file \ No newline at end of file
......
...@@ -22,27 +22,7 @@ import android.widget.EditText; ...@@ -22,27 +22,7 @@ import android.widget.EditText;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.NameValuePair;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.apache.http.protocol.HTTP;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -243,13 +223,14 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo ...@@ -243,13 +223,14 @@ public class SerialActivity extends Activity implements iRestapiListener, iImgDo
@Override @Override
public void result(JSONArray result) { public void result(JSONArray result) {
Log.d(LOG_TAG, "Users:"+result.toString());
} }
@Override @Override
public void result(JSONObject result) { public void result(JSONObject result) {
// Si llego aquí es porque hay un único valor, no un array // Si llego aquí es porque hay un único valor, no un array
try { try {
Log.d(LOG_TAG, result.toString()); Log.d(LOG_TAG, "User:"+result.toString());
// Saco el token y los demás valores // Saco el token y los demás valores
Vector<User> users = new Vector<User>(1); Vector<User> users = new Vector<User>(1);
......
...@@ -5,7 +5,7 @@ buildscript { ...@@ -5,7 +5,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
......
...@@ -685,7 +685,7 @@ module.exports = { ...@@ -685,7 +685,7 @@ module.exports = {
// Leave all rooms // Leave all rooms
for(var i=0; i<rooms.length; i++){ for(var i=0; i<rooms.length; i++){
sails.sockets.leave(req.socket, rooms[i]); sails.sockets.leave(req.socket, rooms[i]);
sails.log.debug("Unsusbscribe from room " + room[i]); sails.log.debug("Unsusbscribe from room " + rooms[i]);
} }
res.json({ res.json({
......
...@@ -199,6 +199,7 @@ module.exports = { ...@@ -199,6 +199,7 @@ module.exports = {
// First, let's get the list of students of the supervisor // First, let's get the list of students of the supervisor
// //
function (cb) { function (cb) {
console.log("getting supervisor's students");
StuSup.find({supervisor: idSup}).populate('student').exec(function(err, stusups){ StuSup.find({supervisor: idSup}).populate('student').exec(function(err, stusups){
if (err) return cb(err); if (err) return cb(err);
if (stusups) { if (stusups) {
...@@ -224,6 +225,7 @@ module.exports = { ...@@ -224,6 +225,7 @@ module.exports = {
// the list of students // the list of students
// //
function (cb) { function (cb) {
console.log("getting office students");
if (req.token.isSupAdmin) { if (req.token.isSupAdmin) {
Student.find({office: req.token.office.id }).exec(function(err, students){ Student.find({office: req.token.office.id }).exec(function(err, students){
if (err) return cb(err); if (err) return cb(err);
...@@ -231,6 +233,7 @@ module.exports = { ...@@ -231,6 +233,7 @@ module.exports = {
var l_stu_id = _.pluck(l_stu, 'id'); // get a list of supervised student ids var l_stu_id = _.pluck(l_stu, 'id'); // get a list of supervised student ids
if (students) { if (students) {
async.eachSeries(students, function(student, next) { async.eachSeries(students, function(student, next) {
console.log("student " + JSON.stringify(student));
if (_.indexOf(l_stu_id, student.id) == -1) { // a new student, let's add it if (_.indexOf(l_stu_id, student.id) == -1) { // a new student, let's add it
// no supervised // no supervised
student.supervision = 0; student.supervision = 0;
...@@ -244,12 +247,13 @@ module.exports = { ...@@ -244,12 +247,13 @@ module.exports = {
}); });
} else cb(); } else cb();
}); });
} } else cb();
}, },
// //
// Populate students with methods // Populate students with methods
// //
function (cb) { function (cb) {
console.log("assigning methods");
async.eachSeries(l_stu, function(student, next) { async.eachSeries(l_stu, function(student, next) {
VStuLastInstruction.findOne(student.id).exec(function(err, row) { VStuLastInstruction.findOne(student.id).exec(function(err, row) {
if (err) { if (err) {
...@@ -274,7 +278,8 @@ module.exports = { ...@@ -274,7 +278,8 @@ module.exports = {
} }
], ],
function(err) { // All steps done! return list of students if no error function(err) { // All steps done! return list of students if no error
if (err) return json(500, {err: err}); console.log("done!");
if (err) return res.json(500, {err: err});
return res.json(l_stu); return res.json(l_stu);
} }
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment