Amount/Unit progress

This commit is contained in:
Jens 2021-04-28 23:19:51 +02:00
parent 26f6e4b7c7
commit d75cb0a32f
2 changed files with 8 additions and 8 deletions

View File

@ -85,7 +85,7 @@ public class ShoppingListEntry
}
else
{
updateAmount();
return updateAmount();
}
}
catch(Exception e)
@ -182,11 +182,11 @@ public class ShoppingListEntry
if(currentAmount + this.getAmount() > 0)
{
// Update the amount
String updateQuery = "UPDATE listEntries set=? WHERE listId=? AND productId=? AND unit=?";
String updateQuery = "UPDATE listEntries set amount=? WHERE listId=? AND productId=? AND unit=?";
preparedStmt = conn.prepareStatement(updateQuery);
preparedStmt.setFloat(1, currentAmount + this.getAmount());
preparedStmt.setLong(2, this.getProduct().getId());
preparedStmt.setLong(2, this.getParentList().getId());
preparedStmt.setLong(3, this.getProduct().getId());
preparedStmt.setLong(4, this.getUnit().getId());
@ -194,11 +194,11 @@ public class ShoppingListEntry
long numAffectedRows = preparedStmt.executeUpdate();
Miscellaneous.logEvent("AMOUNT OF UPDATED ROWS: " + numAffectedRows, 5);
ResultSet rs = preparedStmt.getGeneratedKeys();
// ResultSet rs = preparedStmt.getGeneratedKeys();
if (numAffectedRows > 0)
{
Miscellaneous.logEvent("Amount added to existing entry.", 2);
rs.close();
// rs.close();
preparedStmt.close();
return true;
}
@ -217,11 +217,11 @@ public class ShoppingListEntry
long numAffectedRows = preparedStmt.executeUpdate();
Miscellaneous.logEvent("AMOUNT OF UPDATED ROWS: " + numAffectedRows, 5);
ResultSet rs = preparedStmt.getGeneratedKeys();
// ResultSet rs = preparedStmt.getGeneratedKeys();
if (numAffectedRows > 0)
{
Miscellaneous.logEvent("Resulting amount < 0, entry deleted.", 2);
rs.close();
// rs.close();
preparedStmt.close();
return true;
}

View File

@ -111,7 +111,7 @@ public class Start
exitWithError(Settings.languageBlock.get("productNotFound") + " " + productName);
for(ShoppingListEntry entry : list.getEntries())
{
{bestehende reduzieren
if(entry.getProduct().equals(p))
{
if(entry.delete())