mirror of
https://github.com/jfoucry/Pilldroid.git
synced 2024-11-22 04:29:22 +01:00
Change take loop
This commit is contained in:
parent
4486b45bd9
commit
d0f6f5b1dd
1 changed files with 5 additions and 1 deletions
|
@ -292,13 +292,17 @@ class DBHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
// 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
|
// todo: If some drug moved, must redo all the loop
|
||||||
for (int position = 0 ; position < getCount() ; position++ ) {
|
int position = 0 ;
|
||||||
|
for ( int nbOps = 0; nbOps < getCount() ; nbOps ++ ) {
|
||||||
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(drug);
|
drugs.add(drug);
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
position++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return drugs;
|
return drugs;
|
||||||
|
|
Loading…
Reference in a new issue