Skip to content

Commit

Permalink
Merge branch 'release/2.1.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
Inigo Lopez de Heredia committed Jul 8, 2015
2 parents 10f8fb9 + 01df2c7 commit 4033140
Show file tree
Hide file tree
Showing 17 changed files with 798 additions and 465 deletions.
14 changes: 14 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Akvo FLOW app release notes
===========================

# ver 2.1.8
Date: 8 July 2014

New and noteworthy
------------------
* Forms deleted in the dashboard are disabled in the app [#304]
* Hindi language can be selected for the app UI [#312]
* Multiple barcode questions can be answered with an external bluetooth scanner[#299]

Resolved issues
---------------
* Submitted questions are not editable [#307]
* Handle registration form updates (monitoring surveys)[#310]

# ver 2.1.7
Date: 10 Jun 2015

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.akvo.flow"
android:versionCode="1"
android:versionName="2.1.7" >
android:versionName="2.1.8" >

<uses-sdk
android:minSdkVersion="10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected Cursor loadData(SurveyDbAdapter database) {

return database.query(table,
SurveyQuery.PROJECTION,
SurveyColumns.DELETED + " <> 1 AND " + SurveyColumns.SURVEY_GROUP_ID + " = ?",
SurveyColumns.SURVEY_GROUP_ID + " = ?",
new String[] { String.valueOf(mSurveyGroupId) },
Tables.SURVEY + "." + SurveyColumns.SURVEY_ID,
null,
Expand All @@ -66,12 +66,14 @@ public interface SurveyQuery {
Tables.SURVEY + "." + SurveyColumns.SURVEY_ID,
Tables.SURVEY + "." + SurveyColumns.NAME,
Tables.SURVEY + "." + SurveyColumns.VERSION,
Tables.SURVEY + "." + SurveyColumns.DELETED,
Tables.SURVEY_INSTANCE + "." + SurveyInstanceColumns.SUBMITTED_DATE
};

int SURVEY_ID = 0;
int NAME = 1;
int VERSION = 2;
int SUBMITTED = 3;
int DELETED = 3;
int SUBMITTED = 4;
}
}
59 changes: 33 additions & 26 deletions app/src/main/java/org/akvo/flow/dao/SurveyDbAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public interface SurveyInstanceColumns {
public interface TransmissionColumns {
String _ID = "_id";
String SURVEY_INSTANCE_ID = "survey_instance_id";
String SURVEY_ID = "survey_id";
String FILENAME = "filename";
String STATUS = "status";// separate table/constants?
String START_DATE = "start_date";// do we really need this column?
Expand Down Expand Up @@ -177,10 +178,11 @@ public interface SurveyInstanceStatus {
}

public interface TransmissionStatus {
int QUEUED = 0;
int IN_PROGRESS = 1;
int SYNCED = 2;
int FAILED = 3;
int QUEUED = 0;
int IN_PROGRESS = 1;
int SYNCED = 2;
int FAILED = 3;
int FORM_DELETED = 4;
}

private static final String TAG = "SurveyDbAdapter";
Expand Down Expand Up @@ -208,7 +210,8 @@ public interface TransmissionStatus {

private static final int VER_LAUNCH = 78;// App refactor version. Start from scratch
private static final int VER_FORM_SUBMITTER = 79;
private static final int DATABASE_VERSION = VER_FORM_SUBMITTER;
private static final int VER_FORM_DEL_CHECK = 80;
private static final int DATABASE_VERSION = VER_FORM_DEL_CHECK;

private final Context context;

Expand Down Expand Up @@ -296,6 +299,7 @@ public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + Tables.TRANSMISSION + " ("
+ TransmissionColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
+ TransmissionColumns.SURVEY_INSTANCE_ID + " INTEGER NOT NULL,"
+ TransmissionColumns.SURVEY_ID + " TEXT,"
+ TransmissionColumns.FILENAME + " TEXT,"
+ TransmissionColumns.STATUS + " INTEGER,"
+ TransmissionColumns.START_DATE + " INTEGER,"
Expand Down Expand Up @@ -332,6 +336,9 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
case VER_LAUNCH:
db.execSQL("ALTER TABLE " + Tables.SURVEY_INSTANCE
+ " ADD COLUMN " + SurveyInstanceColumns.SUBMITTER + " TEXT");
case VER_FORM_SUBMITTER:
db.execSQL("ALTER TABLE " + Tables.TRANSMISSION
+ " ADD COLUMN " + TransmissionColumns.SURVEY_ID + " TEXT");
version = DATABASE_VERSION;
}

Expand Down Expand Up @@ -930,8 +937,8 @@ public void deleteResponses(String surveyInstanceId) {
public void deleteSurveyInstance(String surveyInstanceId) {
deleteResponses(surveyInstanceId);
database.delete(Tables.SURVEY_INSTANCE, SurveyInstanceColumns._ID + "=?",
new String[] {
surveyInstanceId
new String[]{
surveyInstanceId
});
}

Expand All @@ -943,20 +950,21 @@ public void deleteSurveyInstance(String surveyInstanceId) {
*/
public void deleteResponse(long surveyInstanceId, String questionId) {
database.delete(Tables.RESPONSE, ResponseColumns.SURVEY_INSTANCE_ID + "= ? AND "
+ ResponseColumns.QUESTION_ID + "= ?", new String[] {
+ ResponseColumns.QUESTION_ID + "= ?", new String[]{
String.valueOf(surveyInstanceId),
questionId
});
}

public void createTransmission(long surveyInstanceId, String filename) {
createTransmission(surveyInstanceId, filename, TransmissionStatus.QUEUED);
public void createTransmission(long surveyInstanceId, String formID, String filename) {
createTransmission(surveyInstanceId, formID, filename, TransmissionStatus.QUEUED);
}


public void createTransmission(long surveyInstanceId, String filename, int status) {
public void createTransmission(long surveyInstanceId, String formID, String filename, int status) {
ContentValues values = new ContentValues();
values.put(TransmissionColumns.SURVEY_INSTANCE_ID, surveyInstanceId);
values.put(TransmissionColumns.SURVEY_ID, formID);
values.put(TransmissionColumns.FILENAME, filename);
values.put(TransmissionColumns.STATUS, status);
if (TransmissionStatus.SYNCED == status) {
Expand Down Expand Up @@ -999,6 +1007,7 @@ public List<FileTransmission> getFileTransmissions(Cursor cursor) {
final int startCol = cursor.getColumnIndexOrThrow(TransmissionColumns.START_DATE);
final int endCol = cursor.getColumnIndexOrThrow(TransmissionColumns.END_DATE);
final int idCol = cursor.getColumnIndexOrThrow(TransmissionColumns._ID);
final int formIdCol = cursor.getColumnIndexOrThrow(TransmissionColumns.SURVEY_ID);
final int surveyInstanceCol = cursor.getColumnIndexOrThrow(TransmissionColumns.SURVEY_INSTANCE_ID);
final int fileCol = cursor.getColumnIndexOrThrow(TransmissionColumns.FILENAME);
final int statusCol = cursor.getColumnIndexOrThrow(TransmissionColumns.STATUS);
Expand All @@ -1007,6 +1016,7 @@ public List<FileTransmission> getFileTransmissions(Cursor cursor) {
do {
FileTransmission trans = new FileTransmission();
trans.setId(cursor.getLong(idCol));
trans.setFormId(cursor.getString(formIdCol));
trans.setRespondentId(cursor.getLong(surveyInstanceCol));
trans.setFileName(cursor.getString(fileCol));
trans.setStatus(cursor.getInt(statusCol));
Expand All @@ -1032,8 +1042,9 @@ public List<FileTransmission> getFileTransmissions(long surveyInstanceId) {
Cursor cursor = database.query(Tables.TRANSMISSION,
new String[] {
TransmissionColumns._ID, TransmissionColumns.SURVEY_INSTANCE_ID,
TransmissionColumns.STATUS, TransmissionColumns.FILENAME,
TransmissionColumns.START_DATE, TransmissionColumns.END_DATE
TransmissionColumns.SURVEY_ID, TransmissionColumns.STATUS,
TransmissionColumns.FILENAME, TransmissionColumns.START_DATE,
TransmissionColumns.END_DATE
},
TransmissionColumns.SURVEY_INSTANCE_ID + " = ?",
new String[] { String.valueOf(surveyInstanceId) },
Expand All @@ -1049,8 +1060,9 @@ public List<FileTransmission> getUnsyncedTransmissions() {
Cursor cursor = database.query(Tables.TRANSMISSION,
new String[] {
TransmissionColumns._ID, TransmissionColumns.SURVEY_INSTANCE_ID,
TransmissionColumns.STATUS, TransmissionColumns.FILENAME,
TransmissionColumns.START_DATE, TransmissionColumns.END_DATE
TransmissionColumns.SURVEY_ID, TransmissionColumns.STATUS,
TransmissionColumns.FILENAME, TransmissionColumns.START_DATE,
TransmissionColumns.END_DATE
},
TransmissionColumns.STATUS + " IN (?, ?, ?)",
new String[] {
Expand Down Expand Up @@ -1353,16 +1365,11 @@ public void deleteSurveyGroup(long surveyGroupId) {
*
* @param surveyId
*/
public void deleteSurvey(String surveyId, boolean physicalDelete) {
if (!physicalDelete) {
ContentValues updatedValues = new ContentValues();
updatedValues.put(SurveyColumns.DELETED, 1);
database.update(Tables.SURVEY, updatedValues, SurveyColumns.SURVEY_ID + " = ?",
new String[] { surveyId });
} else {
database.delete(Tables.SURVEY, SurveyColumns.SURVEY_ID + " = ? ",
new String[] { surveyId });
}
public void deleteSurvey(String surveyId) {
ContentValues updatedValues = new ContentValues();
updatedValues.put(SurveyColumns.DELETED, 1);
database.update(Tables.SURVEY, updatedValues, SurveyColumns.SURVEY_ID + " = ?",
new String[] { surveyId });
}

/**
Expand Down Expand Up @@ -1624,7 +1631,7 @@ public void syncSurveyInstances(List<SurveyInstance> surveyInstances, String sur

// The filename is a unique column in the transmission table, and as we do not have
// a file to hold this data, we set the value to the instance UUID
createTransmission(id, surveyInstance.getUuid(), TransmissionStatus.SYNCED);
createTransmission(id, surveyInstance.getSurveyId(), surveyInstance.getUuid(), TransmissionStatus.SYNCED);
}
}

Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/org/akvo/flow/domain/FileTransmission.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
public class FileTransmission {
private Long id;
private Long respondentId;
private String formId;
private String fileName;
private Date startDate;
private Date endDate;
Expand Down Expand Up @@ -79,4 +80,11 @@ public void setEndDate(Date endDate) {
this.endDate = endDate;
}

public String getFormId() {
return formId;
}

public void setFormId(String formId) {
this.formId = formId;
}
}
Loading

0 comments on commit 4033140

Please sign in to comment.