issues #944 closed

parent 4e6d32c1
...@@ -24,7 +24,7 @@ android { ...@@ -24,7 +24,7 @@ android {
resValue "bool", "ssl_connect", "true" resValue "bool", "ssl_connect", "true"
resValue "bool", "force_img_download", "false" resValue "bool", "force_img_download", "false"
resValue "integer", "netservice_timing", "5" resValue "integer", "netservice_timing", "5"
resValue "integer", "netservice_force_restfull_synchro", "0" resValue "integer", "netservice_force_restfull_synchro", "30"
} }
debug { debug {
resValue "string", "server", "https://dev.yottacode.com" resValue "string", "server", "https://dev.yottacode.com"
...@@ -32,7 +32,7 @@ android { ...@@ -32,7 +32,7 @@ android {
resValue "bool", "ssl_connect", "false" resValue "bool", "ssl_connect", "false"
resValue "bool", "force_img_download", "false" resValue "bool", "force_img_download", "false"
resValue "integer", "netservice_timing", "5" resValue "integer", "netservice_timing", "5"
resValue "integer", "netservice_force_restfull_synchro", "0" resValue "integer", "netservice_force_restfull_synchro", "30"
} }
} }
} }
......
...@@ -182,6 +182,7 @@ public class PCBDBHelper extends SQLiteOpenHelper { ...@@ -182,6 +182,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
ContentValues values=new ContentValues(5); ContentValues values=new ContentValues(5);
values.put("id_stu", id_stu); values.put("id_stu", id_stu);
db.beginTransaction();
for (Picto picto : vocabulary) { for (Picto picto : vocabulary) {
//Log.e(LOG_TAG,"inserting "+picto.get_id()+":"+picto.get_translation()+":"+picto.get_json_attrs()); //Log.e(LOG_TAG,"inserting "+picto.get_id()+":"+picto.get_translation()+":"+picto.get_json_attrs());
newsize++; newsize++;
...@@ -194,7 +195,8 @@ public class PCBDBHelper extends SQLiteOpenHelper { ...@@ -194,7 +195,8 @@ public class PCBDBHelper extends SQLiteOpenHelper {
int seconds2 = Calendar.getInstance().get(Calendar.SECOND); int seconds2 = Calendar.getInstance().get(Calendar.SECOND);
Log.i(LOG_TAG, " Local student vocabulary updated, id:" + id_stu + ", cats: " + vocabulary.size() + " time:" + (seconds2 - seconds1) + " secs. Size: " + newsize + " read only?" + db.isReadOnly()); Log.i(LOG_TAG, " Local student vocabulary updated, id:" + id_stu + ", cats: " + vocabulary.size() + " time:" + (seconds2 - seconds1) + " secs. Size: " + newsize + " read only?" + db.isReadOnly());
db.setTransactionSuccessful();
db.endTransaction();
db.close(); db.close();
} }
......
...@@ -92,7 +92,6 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -92,7 +92,6 @@ 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"));
String text= attrs_picto.getString("expression"); String text= attrs_picto.getString("expression");
addPicto(new Picto(picto_id, uri, text, attrs_picto),ImgDownloader.tsource.remote); addPicto(new Picto(picto_id, uri, text, attrs_picto),ImgDownloader.tsource.remote);
} catch (JSONException e) { } catch (JSONException e) {
......
...@@ -189,15 +189,16 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -189,15 +189,16 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
Log.i(LOG_TAG, "PCB reconnect"); Log.i(LOG_TAG, "PCB reconnect");
PCBcontext.getRoom().connect(); PCBcontext.getRoom().connect();
PCBcontext.getVocabulary().synchronize(); PCBcontext.getVocabulary().synchronize();
synchronizeStudentAttributes();
PCBcontext.getActionLog().batch(); PCBcontext.getActionLog().batch();
} }
} else { } else {
//cada restfullSynchroTimming aprox. se fuerza sincronización de vocabulario y configuración de usuario //cada restfullSynchroTimming aprox. se fuerza sincronización de vocabulario y configuración de usuario
long now = new Date().getTime(); long now = new Date().getTime();
Log.i(LOG_TAG, "Vocabulary request?"+PCBcontext.is_user_logged()+" ("+restfullSynchroTimming+" milisecs)");
if (PCBcontext.is_user_logged()) { if (PCBcontext.is_user_logged()) {
if (restfullSynchroTimming > 0 && (now - lastRestfullSynchro > restfullSynchroTimming)) { if (restfullSynchroTimming > 0 && (now - lastRestfullSynchro > restfullSynchroTimming)) {
Log.i(LOG_TAG, "Vocabulary request");
PCBcontext.getVocabulary().synchronize(); PCBcontext.getVocabulary().synchronize();
synchronizeStudentAttributes(); synchronizeStudentAttributes();
lastRestfullSynchro = now; lastRestfullSynchro = now;
......
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