disabled demo mode;

Use DBHelper to updateDrug after currentStock updateed
This commit is contained in:
Jacques Foucry 2020-04-25 12:07:29 +02:00
parent 58d709152e
commit f90c0df17b

View file

@ -62,8 +62,8 @@ public class MedicamentListActivity extends AppCompatActivity {
// TODO: Change DEMO/DBDEMO form statci to non-static. In order to create fake data at only at launchtime // TODO: Change DEMO/DBDEMO form statci to non-static. In order to create fake data at only at launchtime
private boolean mTwoPane; private boolean mTwoPane;
final static Boolean DEMO = true; final Boolean DEMO = false;
final static Boolean DBDEMO = true; final Boolean DBDEMO = false;
final static Random random = new Random(); final static Random random = new Random();
@Override @Override
@ -232,12 +232,14 @@ public class MedicamentListActivity extends AppCompatActivity {
public void newStockCalculation() { public void newStockCalculation() {
Medicament currentMedicament; Medicament currentMedicament;
DBHelper dbHelper = new DBHelper();
for (int position = 0 ; position < this. getCount() ; position++ ) { for (int position = 0 ; position < this. getCount() ; position++ ) {
currentMedicament = this.getItem(position); currentMedicament = this.getItem(position);
currentMedicament.newStock(currentMedicament.getStock()); currentMedicament.newStock(currentMedicament.getStock());
dbHelper.updateDrug(currentMedicament);
} }
// TODO: Must record new stock in DB
// TODO: si un des médicaments est en rouge, on déclanche une notification visuelle pour dans 5 secondes // TODO: si un des médicaments est en rouge, on déclanche une notification visuelle pour dans 5 secondes
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();