diff --git a/SWADroid/src/es/ugr/swad/swadroid/model/DataBaseHelper.java b/SWADroid/src/es/ugr/swad/swadroid/model/DataBaseHelper.java index 613422a2..39cf038d 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/model/DataBaseHelper.java +++ b/SWADroid/src/es/ugr/swad/swadroid/model/DataBaseHelper.java @@ -836,7 +836,7 @@ public class DataBaseHelper { public void upgradeDB(Context context) throws XmlPullParserException, IOException { //cleanTables(); //initializeDB(); - //compactDB(); + compactDB(); /*db.getDB().execSQL("CREATE TEMPORARY TABLE __" + Global.DB_TABLE_NOTIFICATIONS diff --git a/SWADroid/src/es/ugr/swad/swadroid/modules/notifications/Notifications.java b/SWADroid/src/es/ugr/swad/swadroid/modules/notifications/Notifications.java index 17289556..bc80bc99 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/modules/notifications/Notifications.java +++ b/SWADroid/src/es/ugr/swad/swadroid/modules/notifications/Notifications.java @@ -185,6 +185,8 @@ public class Notifications extends Module { sendRequest(Notification.class, false); if (result != null) { + dbHelper.beginTransaction(); + //Stores notifications data returned by webservice response Vector res = (Vector) result; SoapObject soap = (SoapObject) res.get(1); @@ -213,6 +215,8 @@ public class Notifications extends Module { //Clear old notifications to control database size dbHelper.clearOldNotifications(SIZE_LIMIT); + + dbHelper.endTransaction(); } } diff --git a/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsConfigDownload.java b/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsConfigDownload.java index 462ea692..f44e1451 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsConfigDownload.java +++ b/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsConfigDownload.java @@ -260,9 +260,7 @@ public class TestsConfigDownload extends Module { protected void postConnect() { if(numQuestions == 0) { Toast.makeText(this, R.string.noQuestionsAvailableTestsDownloadMsg, Toast.LENGTH_LONG).show(); - } - - if(!isPluggable) { + } else if(!isPluggable) { Toast.makeText(this, R.string.noQuestionsPluggableTestsDownloadMsg, Toast.LENGTH_LONG).show(); } diff --git a/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsQuestionsDownload.java b/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsQuestionsDownload.java index 9e73238f..c4277f52 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsQuestionsDownload.java +++ b/SWADroid/src/es/ugr/swad/swadroid/modules/tests/TestsQuestionsDownload.java @@ -151,13 +151,10 @@ public class TestsQuestionsDownload extends Module { Log.d(TAG, "UPDATED: " + q.toString()); } } - - dbHelper.endTransaction(); + Log.i(TAG, "Retrieved " + listSize + " questions"); - //Read answers info from webservice response - dbHelper.beginTransaction(); - + //Read answers info from webservice response listSize = answersListObject.getPropertyCount(); for (int i = 0; i < listSize; i++) { SoapObject pii = (SoapObject)answersListObject.getProperty(i); @@ -184,12 +181,9 @@ public class TestsQuestionsDownload extends Module { } } - dbHelper.endTransaction(); Log.i(TAG, "Retrieved " + listSize + " answers"); - //Read relationships between questions and tags from webservice response - dbHelper.beginTransaction(); - + //Read relationships between questions and tags from webservice response listSize = questionTagsListObject.getPropertyCount(); for (int i = 0; i < listSize; i++) { SoapObject pii = (SoapObject)questionTagsListObject.getProperty(i); @@ -220,7 +214,6 @@ public class TestsQuestionsDownload extends Module { } } - dbHelper.endTransaction(); Log.i(TAG, "Retrieved " + listSize + " relationships between questions and tags"); //Update last time test was updated @@ -228,6 +221,7 @@ public class TestsQuestionsDownload extends Module { Test testConfig = oldTestConfigDB; testConfig.setEditTime(System.currentTimeMillis() / 1000L); dbHelper.updateTestConfig(oldTestConfigDB, testConfig); + dbHelper.endTransaction(); } //Request finalized without errors