Arreglado el obtener el active scene de user como -1 que ocurria a veces

parent f018b7df
...@@ -51,7 +51,8 @@ public abstract class Action { ...@@ -51,7 +51,8 @@ public abstract class Action {
Log.d("TIMESTAMP-----------> ", datetime.format(currentTime)); Log.d("TIMESTAMP-----------> ", datetime.format(currentTime));
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());
jsonObject.put(param_id_scene, PCBcontext.getPcbdb().getCurrentUser().get_active_scene()); //TODO: Esto coge -1 Log.i("TAG_PRUEBAS","ACTION_ID_SCENE: "+PCBcontext.getPcbdb().getCurrentUser().get_active_scene());
jsonObject.put(param_id_scene, PCBcontext.getPcbdb().getCurrentUser().get_active_scene());
} }
//TODO Decidir qué almacenar con DEVICE //TODO Decidir qué almacenar con DEVICE
//if (PCBcontext.getDevice().getDeviceID()!=null) //if (PCBcontext.getDevice().getDeviceID()!=null)
......
...@@ -253,12 +253,13 @@ public class User { ...@@ -253,12 +253,13 @@ public class User {
* @return The id of the active scene of this student * @return The id of the active scene of this student
*/ */
public int get_active_scene() { public int get_active_scene() {
try { /*try {
return this.attributes_stu.getInt(JSON_STUDENT_ATTTRS.ID_ACTIVE_SCENE); return this.attributes_stu.getInt(JSON_STUDENT_ATTTRS.ID_ACTIVE_SCENE);
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
} }
return -1; return -1;*/
return this.id_scene_stu;
} }
public void set_active_scene(int id) { public void set_active_scene(int id) {
......
...@@ -189,18 +189,19 @@ public class UserLogin { ...@@ -189,18 +189,19 @@ public class UserLogin {
String st_gender = user.getString(TAG_GENDER); String st_gender = user.getString(TAG_GENDER);
String st_lang = user.getString(TAG_LANG); String st_lang = user.getString(TAG_LANG);
String st_attributes = user.getString(TAG_ATTRIBUTES); String st_attributes = user.getString(TAG_ATTRIBUTES);
set_student_oline( User newStu = new User(st_id_int,
new User(st_id_int, username,
username, password,
password, st_name,
st_name, st_surname,
st_surname, st_id_scene,
st_id_scene, st_pic,
st_pic, st_gender,
st_gender, st_lang,
st_lang, st_attributes,
st_attributes, User.NO_SUPERVISOR, "", "", "", "", "", "M", "es-es", "", "");
User.NO_SUPERVISOR, "", "", "", "", "", "M", "es-es", "", "") newStu.set_active_scene(st_id_scene);
set_student_oline(newStu
, result.getString(TAG_TOKEN) , result.getString(TAG_TOKEN)
, pictogramActivity, activity); , pictogramActivity, activity);
} catch (JSONException e) { } catch (JSONException e) {
......
...@@ -96,7 +96,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -96,7 +96,7 @@ public class Vocabulary implements Iterable<Picto> {
JSONObject attrs_picto = args.getJSONObject("attributes"); JSONObject attrs_picto = args.getJSONObject("attributes");
attrs_picto.put(Picto.JSON_ATTTRS.STUPICTO_ID,args.getInt("id")); attrs_picto.put(Picto.JSON_ATTTRS.STUPICTO_ID,args.getInt("id"));
Picto newPicto=new Picto(picto_id, uri, attrs_picto); Picto newPicto=new Picto(picto_id, uri, attrs_picto);
Picto prev_picto=/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories() Picto prev_picto=PCBcontext.getVocabulary().has_categories()
? find_picto(newPicto.get_category(), newPicto.get_row(),newPicto.get_column()) ? find_picto(newPicto.get_category(), newPicto.get_row(),newPicto.get_column())
: find_picto(newPicto.getFreeRow(),newPicto.getFreeColumn()); : find_picto(newPicto.getFreeRow(),newPicto.getFreeColumn());
......
...@@ -324,7 +324,6 @@ public class PictoUploader { ...@@ -324,7 +324,6 @@ public class PictoUploader {
params.put("id_stu", Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_id_stu())); params.put("id_stu", Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_id_stu()));
//params.put("id_pic", Integer.toString(this.picto.get_id())); //params.put("id_pic", Integer.toString(this.picto.get_id()));
//params.put("id_scene" , Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_active_scene())); //params.put("id_scene" , Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_active_scene()));
params.put("id_stuPicto", Integer.toString(this.picto.get_stupicto_id())); params.put("id_stuPicto", Integer.toString(this.picto.get_stupicto_id()));
Log.i(LOG_TAG, "Picto "+ this.picto.get_id()+" stupicto id:"+this.picto.get_stupicto_id()+" Uploading " + params.toString()); Log.i(LOG_TAG, "Picto "+ this.picto.get_id()+" stupicto id:"+this.picto.get_stupicto_id()+" Uploading " + params.toString());
PCBcontext.getRestapiWrapper().ask( PCBcontext.getRestapiWrapper().ask(
......
...@@ -80,7 +80,7 @@ public final class PCBcontext { ...@@ -80,7 +80,7 @@ public final class PCBcontext {
Log.i("TAG_PRUEBAS","ID_SCENE_VOCAB: "+PCBcontext.getVocabulary().getId_scene()+ Log.i("TAG_PRUEBAS","ID_SCENE_VOCAB: "+PCBcontext.getVocabulary().getId_scene()+
"ID_SCENE_USER: "+PCBcontext.getPcbdb().getCurrentUser().get_active_scene()); "ID_SCENE_USER: "+PCBcontext.getPcbdb().getCurrentUser().get_active_scene());
if (updatedStudent.is_picto_size_big()!=getPcbdb().getCurrentUser().is_picto_size_big() || PCBcontext.getVocabulary().has_categories() != vocabulary.has_categories() if (updatedStudent.is_picto_size_big()!=getPcbdb().getCurrentUser().is_picto_size_big() || PCBcontext.getVocabulary().has_categories() != vocabulary.has_categories()
/*|| PCBcontext.getVocabulary().getId_scene()!= PCBcontext.getPcbdb().getCurrentUser().get_active_scene()*/) { || PCBcontext.getVocabulary().getId_scene()!= PCBcontext.getPcbdb().getCurrentUser().get_active_scene()) {
PCBcontext.getNetService().restart_app(false); PCBcontext.getNetService().restart_app(false);
}else { }else {
......
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