Fix the updateDrug bug (running since almost 6 months)

This commit is contained in:
jacques 2020-09-30 17:59:18 +02:00
parent 05aeaa858c
commit 017e28c016

View file

@ -112,6 +112,8 @@ public class MedicamentDetailActivity extends AppCompatActivity {
DBHelper dbHelper = new DBHelper(this); DBHelper dbHelper = new DBHelper(this);
Medicament newMedicament = dbHelper.getDrugByCIP13(medicament.getCip13());
View stockView; View stockView;
View priseView; View priseView;
View warningView; View warningView;
@ -133,6 +135,7 @@ public class MedicamentDetailActivity extends AppCompatActivity {
TextView warningTextView = warningView.findViewById(R.id.valeur); TextView warningTextView = warningView.findViewById(R.id.valeur);
String warningValue = warningTextView.getText().toString(); String warningValue = warningTextView.getText().toString();
Log.d(TAG, "StockValue == "+ stockValue); Log.d(TAG, "StockValue == "+ stockValue);
Log.d(TAG, "PriseValue == "+ priseValue); Log.d(TAG, "PriseValue == "+ priseValue);
Log.d(TAG, "AlertValue == "+ alertValue); Log.d(TAG, "AlertValue == "+ alertValue);
@ -140,13 +143,13 @@ public class MedicamentDetailActivity extends AppCompatActivity {
Log.d(TAG, "medicamentID == "+ medicament.getId()); Log.d(TAG, "medicamentID == "+ medicament.getId());
Log.d(TAG, "medicament == "+ medicament.toString()); Log.d(TAG, "medicament == "+ medicament.toString());
medicament.setStock(Double.parseDouble(stockValue)); newMedicament.setStock(Double.parseDouble(stockValue));
medicament.setPrise(Double.parseDouble(priseValue)); newMedicament.setPrise(Double.parseDouble(priseValue));
medicament.setWarnThreshold(Integer.parseInt(warningValue)); newMedicament.setWarnThreshold(Integer.parseInt(warningValue));
medicament.setAlertThreshold(Integer.parseInt(alertValue)); newMedicament.setAlertThreshold(Integer.parseInt(alertValue));
medicament.setDateLastUpdate(); newMedicament.setDateLastUpdate();
medicament.setDateEndOfStock(); newMedicament.setDateEndOfStock();
dbHelper.updateDrug(medicament); dbHelper.updateDrug(newMedicament);
} }
} }