This commit is contained in:
jacques 2021-06-26 17:51:05 +02:00
parent 7d3cdee933
commit 4486b45bd9

View file

@ -151,7 +151,7 @@ class DBHelper extends SQLiteOpenHelper {
drug.setId(Integer.parseInt(cursor.getString(0))); drug.setId(Integer.parseInt(cursor.getString(0)));
drug.setCis(cursor.getString(1)); drug.setCis(cursor.getString(1));
drug.setCip13(cursor.getString(2)); drug.setCip13(cursor.getString(2));
drug.setNama(cursor.getString(3)); drug.setName(cursor.getString(3));
drug.setAdministration_mode(cursor.getString(4)); drug.setAdministration_mode(cursor.getString(4));
drug.setPresentation(cursor.getString(5)); drug.setPresentation(cursor.getString(5));
drug.setStock(Double.parseDouble(cursor.getString(6))); drug.setStock(Double.parseDouble(cursor.getString(6)));
@ -199,7 +199,7 @@ class DBHelper extends SQLiteOpenHelper {
drug.setId(Integer.parseInt(cursor.getString(0))); drug.setId(Integer.parseInt(cursor.getString(0)));
drug.setCis(cursor.getString(1)); drug.setCis(cursor.getString(1));
drug.setCip13(cursor.getString(2)); drug.setCip13(cursor.getString(2));
drug.setNama(cursor.getString(3)); drug.setName(cursor.getString(3));
drug.setAdministration_mode(cursor.getString(4)); drug.setAdministration_mode(cursor.getString(4));
drug.setPresentation(cursor.getString(5)); drug.setPresentation(cursor.getString(5));
drug.setStock(Double.parseDouble(cursor.getString(6))); drug.setStock(Double.parseDouble(cursor.getString(6)));
@ -241,7 +241,7 @@ class DBHelper extends SQLiteOpenHelper {
drug.setId(Integer.parseInt(cursor.getString(0))); drug.setId(Integer.parseInt(cursor.getString(0)));
drug.setCis(cursor.getString(1)); drug.setCis(cursor.getString(1));
drug.setCip13(cursor.getString(2)); drug.setCip13(cursor.getString(2));
drug.setNama(cursor.getString(3)); drug.setName(cursor.getString(3));
drug.setAdministration_mode(cursor.getString(4)); drug.setAdministration_mode(cursor.getString(4));
drug.setPresentation(cursor.getString(5)); drug.setPresentation(cursor.getString(5));
drug.setStock(Double.parseDouble(cursor.getString(6))); drug.setStock(Double.parseDouble(cursor.getString(6)));
@ -291,13 +291,14 @@ class DBHelper extends SQLiteOpenHelper {
Log.d(TAG, "After sort " + drugs.toString()); Log.d(TAG, "After sort " + drugs.toString());
// Move drug with prise = 0 at the end of the list // Move drug with prise = 0 at the end of the list
// todo: If some drug moved, must redo all the loop
for (int position = 0 ; position < getCount() ; position++ ) { for (int position = 0 ; position < getCount() ; position++ ) {
currentDrug = getItem(position); currentDrug = getItem(position);
double currentTake = currentDrug.getTake(); double currentTake = currentDrug.getTake();
if (currentTake == 0) if (currentTake == 0)
{ {
drug = drugs.remove(position); drug = drugs.remove(position);
drugs.add(drugs.size(), drug); drugs.add(drug);
} }
} }
return drugs; return drugs;