issue #199 closed

parent a593f9e0
......@@ -15,7 +15,6 @@ import com.yottacode.pictogram.tools.PCBcontext;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Calendar;
import java.util.Vector;
/**
......@@ -222,17 +221,12 @@ public class PCBDBHelper extends SQLiteOpenHelper {
public void setStudentVocabulary(Vocabulary vocabulary) {
SQLiteDatabase db = this.getWritableDatabase();
int id_stu = this.getCurrentUser().get_id_stu();
int seconds1 = Calendar.getInstance().get(Calendar.SECOND);
Log.i("TAG_PRUEBAS","tamVoc to insert: "+vocabulary.size());
db.delete("collection", "id_stu=" + id_stu, null);
int newsize=0;
ContentValues values=new ContentValues(6);
values.put("id_stu", id_stu);
db.beginTransaction();
for (Picto picto : vocabulary) {
Log.e("TAG_PRUEBAS","inserting "+picto.get_id()+":"+picto.get_translation()+":"+picto.get_json_attrs());
newsize++;
values.put("id_picto", picto.get_id());
values.put("id_scene", 135/*getActiveSceneForStudent(id_stu)*/);
values.put("url", picto.get_url());
......@@ -241,8 +235,6 @@ public class PCBDBHelper extends SQLiteOpenHelper {
db.insert("collection_detail", null, values);
}
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());
db.setTransactionSuccessful();
db.endTransaction();
//db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ
......
......@@ -207,7 +207,7 @@ public class Vocabulary implements Iterable<Picto> {
picto = stupicto.getJSONObject("picto");
attributes = stupicto.getJSONObject("attributes");
attributes.put(Picto.JSON_ATTTRS.STUPICTO_ID, stupicto.getInt("id"));
pictos[i] = new Picto(stupicto.getInt("id"),
pictos[i] = new Picto(picto.getInt("id"),
picto.getString("uri"),
attributes);
}
......
......@@ -325,7 +325,7 @@ public class PictoUploader {
params.put("id_stu", Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_id_stu()));
params.put("id_pic", Integer.toString(this.picto.get_id()));
Log.i(LOG_TAG, "Picto 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.getPcbdb().getCurrentUser().get_restapi_operation_stu() + "/picto",
params, "put", new RestapiWrapper.iRestapiListener() {
......
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