Skip to content

Commit

Permalink
Merge branch 'main' into ux_enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
bellerbrock committed May 28, 2024
2 parents 0fd8373 + 3e323b2 commit dcf7728
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 19 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ jobs:
${{ steps.matching_release.outputs.body }}
${{ env.COMMIT_MSG }}
# - name: Release APK to Play Store
# uses: r0adkll/upload-google-play@v1
# with:
# serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
# packageName: com.fieldbook.tracker
# releaseFiles: app/build/outputs/apk/release/app-release-unsigned-signed.apk
# track: alpha
- name: Release APK to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.fieldbook.tracker
releaseFiles: app/build/outputs/apk/release/app-release-unsigned-signed.apk
track: alpha
10 changes: 7 additions & 3 deletions app/src/main/java/com/fieldbook/tracker/database/DataHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -2703,11 +2703,11 @@ public ObservationModel[] getRepeatedValues(String studyId, String plotId, Strin
return ObservationDao.Companion.getAllRepeatedValues(studyId, plotId, traitDbId);
}

public String getObservationUnitPropertyByPlotId(String column, String plot_id) {
public String getObservationUnitPropertyByPlotId(String uniqueName, String column, String uniqueId) {

open();

return ObservationUnitPropertyDao.Companion.getObservationUnitPropertyByPlotId(column, plot_id);
return ObservationUnitPropertyDao.Companion.getObservationUnitPropertyByUniqueId(uniqueName, column, uniqueId);
}

/**
Expand Down Expand Up @@ -2772,7 +2772,11 @@ public void onCreate(SQLiteDatabase db) {
Log.e(TAG, e.getMessage());
}

//migrate handles database upgrade from 8 -> 9
Migrator.Companion.createTables(db, getAllTraitObjects(db));

//this will force new databases to have full updates, otherwise sqliteopenhelper will not upgrade
onUpgrade(db, 9, DATABASE_VERSION);
}

/**
Expand Down Expand Up @@ -2962,7 +2966,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

}

if (oldVersion <= 10 & newVersion >= 11) {
if (oldVersion <= 10 && newVersion >= 11) {

// modify studies table for better handling of brapi study attributes
db.execSQL("ALTER TABLE studies ADD COLUMN import_format TEXT");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import android.util.Log
import androidx.preference.PreferenceManager
import com.fieldbook.tracker.database.DataHelper
import com.fieldbook.tracker.database.Migrator.Companion.sObservationUnitPropertyViewName
import com.fieldbook.tracker.database.Migrator.Observation
import com.fieldbook.tracker.database.Migrator.ObservationUnit
import com.fieldbook.tracker.database.Migrator.ObservationUnitAttribute
import com.fieldbook.tracker.database.Migrator.ObservationUnitValue
import com.fieldbook.tracker.database.Migrator.ObservationVariable
import com.fieldbook.tracker.database.Migrator.Study
import com.fieldbook.tracker.database.query
import com.fieldbook.tracker.database.toFirst
Expand All @@ -30,8 +28,8 @@ class ObservationUnitPropertyDao {
// db.query(sObservationUnitPropertyViewName).toTable().toTypedArray()
// }

fun getObservationUnitPropertyByPlotId(column: String, plot_id: String): String = withDatabase { db ->
db.query("ObservationUnitProperty", select = arrayOf(column), where = "plot_id = ?", whereArgs = arrayOf(plot_id))
fun getObservationUnitPropertyByUniqueId(uniqueName: String, column: String, uniqueId: String): String = withDatabase { db ->
db.query(sObservationUnitPropertyViewName, select = arrayOf(column), where = "`${uniqueName}` = ?", whereArgs = arrayOf(uniqueId))
.toFirst()[column].toString()
}?: ""

Expand Down
15 changes: 11 additions & 4 deletions app/src/main/java/com/fieldbook/tracker/dialogs/SearchDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,19 @@
import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;

import dagger.hilt.android.AndroidEntryPoint;

@AndroidEntryPoint
public class SearchDialog extends DialogFragment implements AttributeChooserDialog.OnAttributeSelectedListener, OperatorDialog.OnOperatorClickedListener, SearchAdapter.onEditTextChangedListener, SearchAdapter.onDeleteClickedListener {

@Inject
SharedPreferences ep;

private static final String TAG = "SearchDialog";
private static CollectActivity originActivity;
private SearchAdapter searchAdapter;
private SharedPreferences ep;
private static List<SearchDialogDataModel> dataSet;
public static boolean openResults;
private final onSearchResultsClickedListener onSearchResultsClickedListener;
Expand All @@ -56,8 +63,6 @@ public SearchDialog(CollectActivity activity, onSearchResultsClickedListener onS
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {

ep = requireContext().getSharedPreferences(GeneralKeys.SHARED_PREF_FILE_NAME, 0);

AlertDialog.Builder builder = new AlertDialog.Builder(originActivity, R.style.AppAlertDialog);

View customView = getLayoutInflater().inflate(R.layout.dialog_search, null);
Expand Down Expand Up @@ -164,6 +169,8 @@ public void createSearchResultsDialog () {

if (data != null) {

String uniqueName = ep.getString(GeneralKeys.UNIQUE_NAME, "");

//Array to store all the columns to be displayed in the search results dialog
ArrayList<String> columnsList = new ArrayList<>();
columnsList.add(ep.getString(GeneralKeys.PRIMARY_NAME, getString(R.string.search_results_dialog_range)));
Expand Down Expand Up @@ -208,7 +215,7 @@ public void createSearchResultsDialog () {
}
// If column is an attribute
else {
temp.add(originActivity.getDatabase().getObservationUnitPropertyByPlotId(column, searchdata.unique));
temp.add(originActivity.getDatabase().getObservationUnitPropertyByPlotId(uniqueName, column, searchdata.unique));
}
}
traitData.add(temp);
Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
majorVersion=5
minorVersion=6
patchVersion=16
patchVersion=19

0 comments on commit dcf7728

Please sign in to comment.