def loadCurrentWeight(self): currentweight = SQLStatements.getCurrentWeight(self.userID) self.labelCurrentWeight.setText(str(currentweight)) if (SQLStatements.usersStartingweightValidation(self.userID) == False): startingweight = SQLStatements.getStartingWeight(self.userID) print(startingweight) SQLStatements.addWeightChange(self.userID, startingweight)
def addToDb(self): try: # Adding variable names to the text boxes on add information windows weight = self.ui.lineEditFood.text() # Stores the user ID as a variable and removes the excess string UserID = self.userID UserID = str(UserID) UserID = (UserID.replace("(", "")) UserID = (UserID.replace(")", "")) UserID = (UserID.replace(",", "")) # Validation Check. if (SQLStatements.updateWeight(weight, UserID) == 'True'): SQLStatements.addWeightChange(UserID, weight) QMessageBox.about(QMessageBox(), 'Success', 'added to the database.') else: QMessageBox.warning(QMessageBox(), 'Error', 'Could not be added') except Exception as e: print(e)