Added checkQuantity function.

Adds items to grocery list when they fall below threshold quantity.
Fix database access in ListItem.