def rowingMachine():
    """
    This function is used to count calories for the rowing machine
    """
    # This machine has an interface that count how many time you do a excersises in a certian time
    global frequency  # This number is based on doing 20 excersises in a minute wich is average tempo
    global sportTime  # Time in hours
    clientWeight = gD.getDataWhere('weight', 'customerInfo', '{}'.format(ID))  # Weight of the client that comes form the database
    clientWeight = clientWeight[0][0]
    startWeight = 10
    # You have two different settings:
    #       - Average
    if int(frequency) <= 20:
        startCalorie = 74
        calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
        actualCalorie = calorieTotal * sportTime
        print(int(actualCalorie), "Kcal")
    #       - High frequency
    if int(frequency) > 20:
        startCalorie = 90
        calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
        actualCalorie = calorieTotal * sportTime
        print(int(actualCalorie), "Kcal")
	gD.insertData('customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
              '{}, \'{}\', \'{}\', \'Rowing Machine\', {}'.format(ID, startTime, endTime, actualCalorie))
Пример #2
0
def rowingMachine():
    """
    This function is used to count calories for the rowing machine
    """
    # This machine has an interface that count how many time you do a excersises in a certian time
    global frequency  # This number is based on doing 20 excersises in a minute wich is average tempo
    global sportTime  # Time in hours
    clientWeight = gD.getDataWhere(
        'weight', 'customerInfo',
        '{}'.format(ID))  # Weight of the client that comes form the database
    clientWeight = clientWeight[0][0]
    startWeight = 10
    # You have two different settings:
    #       - Average
    if int(frequency) <= 20:
        startCalorie = 74
        calorieTotal = (startCalorie *
                        ((clientWeight / startWeight) - 1)) + startCalorie
        actualCalorie = calorieTotal * sportTime
        print(int(actualCalorie), "Kcal")
    #       - High frequency
    if int(frequency) > 20:
        startCalorie = 90
        calorieTotal = (startCalorie *
                        ((clientWeight / startWeight) - 1)) + startCalorie
        actualCalorie = calorieTotal * sportTime
        print(int(actualCalorie), "Kcal")
        gD.insertData(
            'customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
            '{}, \'{}\', \'{}\', \'Rowing Machine\', {}'.format(
                ID, startTime, endTime, actualCalorie))
Пример #3
0
def weightlifting():
    """
    This function is used to count te calories used by the client
    """
    liftingWeight = 75
    clientWeight = gD.getDataWhere(
        'weight', 'customerInfo',
        '{}'.format(ID))  # Weight of the client that comes form the database
    clientWeight = clientWeight[0][0]
    startWeight = 10
    global sportTime
    print(sportTime)
    if liftingWeight <= 80:
        startCalorie = 32
        calorieTotal = (startCalorie *
                        ((clientWeight / startWeight) - 1)) + startCalorie
        actualCalorie = calorieTotal * sportTime
        print(int(actualCalorie), "Kcal")
    elif liftingWeight > 80:
        startCalorie = 63
        calorieTotal = (startCalorie *
                        ((clientWeight / startWeight) - 1)) + startCalorie
        actualCalorie = calorieTotal * sportTime
        print(int(actualCalorie), "Kcal")
    gD.insertData(
        'customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
        '{}, \'{}\', \'{}\', \'Rowing Machine\', {}'.format(
            ID, startTime, endTime, actualCalorie))
Пример #4
0
def climbingStairs():
    global scanPass, backData
    scanPassScreen("top")
    thread = threading.Thread(target=reader, args=(True, ))
    thread.start()
    scanPass.mainloop()

    cardData = backData
    cardDataDb = ("rfidNumber = '" + str(cardData) + "'")
    backData = ""
    customerID = gD.getDataWhere("customerID", "loginInfo", cardDataDb)

    Climbing_stairs.main(customerID[0][0])
Пример #5
0
def sendInformation(firstName, surname, street, addressNumber, postalCode, town, country, phoneNumber, email, password, weight, IBAN):
    """
        This function first checks if any of the forms are empty.
        After that it tells you to hold the access card to the reader and it will write the information to the database.
    """
    global window, backData, scanPass
    gender = genderEntry.get() #create a gender variable to use inside this function

    if IBAN == "" or firstName == "" or surname == "" or street == "" or addressNumber == "" or postalCode == "" or town == "" or country == "" or phoneNumber == "" or gender == " " or email == "" or password == "" or weight == "":
        message.showinfo("Information missing", "At least one input box is still empty. Please make sure you filled in al the required information.")

    else:
        try:
            scanPassScreen("top")
            thread = threading.Thread(target=reader, args=(True,))#create a thread to scan access cards while having a window open
            thread.start()
            scanPass.mainloop()
            
            cardData = backData
            backData = ""

            cardDataDb = ("rfidNumber='" + str(cardData) + "'")
            checkRFIDData = gD.getDataWhere("count(*)", "loginInfo", cardDataDb)
            
            if checkRFIDData[0][0] == 0:
                gD.insertInto("customerInfo", "surname, name, gender, cellphoneNumber, weight, IBAN", "'{}', '{}', '{}', '{}', {}, '{}'".format(surname, firstName, gender, phoneNumber, weight, IBAN))
                gD.insertInto("addressInfo", "street, zipcode, addressNumber, town, country", "'{}', '{}', '{}', '{}', '{}'".format(street, postalCode, addressNumber, town, country))
                gD.insertInto("loginInfo","password, email, rfidNumber", "'{}', '{}', '{}'".format(password, email, str(cardData)))

                message.showinfo("It worked", "U are hereby a customer of benno's gym.")

                IBANEntry.delete(0, END)
                firstNameEntry.delete(0, END)
                surnameEntry.delete(0, END)
                streetEntry.delete(0, END)
                addressNumberEntry.delete(0, END)
                postalCodeEntry.delete(0, END)
                townEntry.delete(0, END)
                countryEntry.delete(0, END)
                phoneNumberEntry.delete(0, END)
                emailEntry.delete(0, END)
                genderEntry.set(" ")
                passwordEntry.delete(0, END)
                weightEntry.delete(0, END)

            else:
                message.showinfo("Already in use", "This access card is already registered. Try a different one")
                sendInformation(firstName, surname, street, addressNumber, postalCode, town, country, phoneNumber, email, password, weight, IBAN)
        except:
            message.showinfo("Failed", "Something went wrong. Please try again later.")
def spinningMachine():
    """
    This function is used to count the amount of calories the client uses while spinning
    """
    clientWeight = gD.getDataWhere('weight', 'customerInfo', "customerID = {}".format(ID))  # Weight of the client that comes form the database
    clientWeight = clientWeight[0][0]
    startWeight = 10
    global sportTime
    hourTime = sportTime / 60
    # Spinning has only one setting
    startCalorie = 117
    calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
    actualCalorie = int(calorieTotal) * hourTime
    print(int(actualCalorie), "Kcal")
    gD.insertData('customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
              '{}, \'{}\', \'{}\', \'Spinning machine\', {}'.format(ID, localTime, dateEnd, actualCalorie))
Пример #7
0
def treadmill():
    """
        callable function to be able to start running on a treadmill
    """
    global scanPass, backData
    scanPassScreen("top")
    thread = threading.Thread(target=reader, args=(True, ))
    thread.start()
    scanPass.mainloop()

    cardData = backData
    cardDataDb = ("rfidNumber = '" + str(cardData) + "'")
    backData = ""
    customerID = gD.getDataWhere("customerID", "loginInfo", cardDataDb)

    Treadmill.main(customerID[0][0])
def climbingStairs():
    """
    This function is used to calculate the amount of calories
    """
    clientWeight = gD.getDataWhere('weight', 'customerInfo', '{}'.format(ID))  # Weight of the client that comes form the database
    clientWeight = clientWeight[0][0]
    startWeight = 10
    global sportTime
    hourTime = sportTime / 60
    # Climbing stairs only has one setting
    startCalorie = 60
    calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
    actualCalorie = calorieTotal * hourTime
    print(int(actualCalorie), "Kcal")
    gD.insertData('customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
              '{}, \'{}\', \'{}\', \'Rowing Machine\', {}'.format(ID, startTime, endTime, actualCalorie))
Пример #9
0
def treadmill():
    """
    This function is a calorietracker for running on a treadmill with different settings for the speed of the runner
    """
    global setting
    global sportTime
    clientWeight = gD.getDataWhere(
        'weight', 'customerInfo', "customerID = {}".format(
            ID))  # Weight of the client that comes form the database
    clientWeight = clientWeight[0][0]
    startWeight = 10
    # Different setting on the treadmill:

    #       - 1: Walking 3km/h
    if setting == 1:
        startCalorie = 25
        calorieTotal = (startCalorie *
                        ((clientWeight / startWeight) - 1)) + startCalorie
    #       - 2: Walking 6 km/h
    if setting == 2:
        startCalorie = 50
        calorieTotal = (startCalorie *
                        ((clientWeight / startWeight) - 1)) + startCalorie
    #       - 3: Running 10km/h
    if setting == 3:
        startCalorie = 100
        calorieTotal = (startCalorie *
                        ((clientWeight / startWeight) - 1)) + startCalorie
    #       - 4: Running 12 km/h
    if setting == 4:
        startCalorie = 120
        calorieTotal = (startCalorie *
                        ((clientWeight / startWeight) - 1)) + startCalorie
    #       - 4: Running 15 km/h
    if setting == 5:
        startCalorie = 150
        calorieTotal = (startCalorie *
                        ((clientWeight / startWeight) - 1)) + startCalorie
    # Calculating the amount of burned calories with the time the client actually ran
    actualCalorie = (int(calorieTotal) * sportTime)
    actualCalorie = int(actualCalorie)
    print(actualCalorie, "Kcal")
    gD.insertData(
        'customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
        '{}, \'{}\', \'{}\', \'Rowing Machine\', {}'.format(
            ID, localTime, dateEnd, actualCalorie))
Пример #10
0
def climbingStairs():
    global scanPass, backData
    scanPassScreen("top")
    thread = threading.Thread(target=reader, args=(True, ))
    thread.start()
    scanPass.mainloop()

    for i in range(3):
        GPIO.output(ledGreen, True)
        sleep(0.3)
        GPIO.output(ledGreen, False)
        sleep(0.3)

    cardData = backData
    cardDataDb = ("rfidNumber = '" + str(cardData) + "'")
    backData = ""
    customerID = gD.getDataWhere("customerID", "loginInfo", cardDataDb)

    Climbing_stairs.main(customerID[0][0])
Пример #11
0
def climbingStairs():
    global scanPass, backData
    scanPassScreen("top")
    thread = threading.Thread(target=reader, args=(True,))
    thread.start()
    scanPass.mainloop()

    for i in range(3):
        GPIO.output(ledGreen, True)
        sleep(0.3)
        GPIO.output(ledGreen, False)
        sleep(0.3)
    
    cardData = backData
    cardDataDb = ("rfidNumber = '" + str(cardData) + "'")
    backData = ""
    customerID = gD.getDataWhere("customerID", "loginInfo", cardDataDb)

    Climbing_stairs.main(customerID[0][0])
Пример #12
0
def spinningMachine():
    """
    This function is used to count the amount of calories the client uses while spinning
    """
    clientWeight = gD.getDataWhere(
        'weight', 'customerInfo', "customerID = {}".format(
            ID))  # Weight of the client that comes form the database
    clientWeight = clientWeight[0][0]
    startWeight = 10
    global sportTime
    hourTime = sportTime / 60
    # Spinning has only one setting
    startCalorie = 117
    calorieTotal = (startCalorie *
                    ((clientWeight / startWeight) - 1)) + startCalorie
    actualCalorie = int(calorieTotal) * hourTime
    print(int(actualCalorie), "Kcal")
    gD.insertData(
        'customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
        '{}, \'{}\', \'{}\', \'Spinning machine\', {}'.format(
            ID, localTime, dateEnd, actualCalorie))
Пример #13
0
def climbingStairs():
    """
    This function is used to calculate the amount of calories
    """
    clientWeight = gD.getDataWhere(
        'weight', 'customerInfo',
        '{}'.format(ID))  # Weight of the client that comes form the database
    clientWeight = clientWeight[0][0]
    startWeight = 10
    global sportTime
    hourTime = sportTime / 60
    # Climbing stairs only has one setting
    startCalorie = 60
    calorieTotal = (startCalorie *
                    ((clientWeight / startWeight) - 1)) + startCalorie
    actualCalorie = calorieTotal * hourTime
    print(int(actualCalorie), "Kcal")
    gD.insertData(
        'customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
        '{}, \'{}\', \'{}\', \'Rowing Machine\', {}'.format(
            ID, startTime, endTime, actualCalorie))
def weightlifting():
    """
    This function is used to count te calories used by the client
    """
    liftingWeight = 75
    clientWeight = gD.getDataWhere('weight', 'customerInfo', "customerID = {}".format(ID))  # Weight of the client that comes form the database
    clientWeight = clientWeight[0][0]
    startWeight = 10
    global sportTime
    print(sportTime)
    if liftingWeight <= 80:
        startCalorie = 32
        calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
        actualCalorie = int(calorieTotal) * sportTime
        print(int(actualCalorie), "Kcal")
    elif liftingWeight > 80:
        startCalorie = 63
        calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
        actualCalorie = int(calorieTotal) * sportTime
        print(int(actualCalorie), "Kcal")
    gD.insertData('customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
              '{}, \'{}\', \'{}\', \'Weight lifting\', {}'.format(ID, localTime, dateEnd, actualCalorie))
Пример #15
0
def treadmill():
    """
        callable function to be able to start running on a treadmill
    """
    global scanPass, backData
    scanPassScreen("top")
    thread = threading.Thread(target=reader, args=(True,))
    thread.start()
    scanPass.mainloop()

    for i in range(3):
        GPIO.output(ledGreen, True)
        sleep(0.3)
        GPIO.output(ledGreen, False)
        sleep(0.3)
    
    cardData = backData
    cardDataDb = ("rfidNumber = '" + str(cardData) + "'")
    backData = ""
    customerID = gD.getDataWhere("customerID", "loginInfo", cardDataDb)
    
    Treadmill.main(customerID[0][0])
def treadmill():
    """
    This function is a calorietracker for running on a treadmill with different settings for the speed of the runner
    """
    global setting
    global sportTime
    clientWeight = gD.getDataWhere('weight', 'customerInfo', '{}'.format(ID))  # Weight of the client that comes form the database
    clientWeight = clientWeight[0][0]
    startWeight = 10
    # Different setting on the treadmill:

    #       - 1: Walking 3km/h
    if setting == 1:
        startCalorie = 25
        calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
    #       - 2: Walking 6 km/h
    if setting == 2:
        startCalorie = 50
        calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
    #       - 3: Running 10km/h
    if setting == 3:
        startCalorie = 100
        calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
    #       - 4: Running 12 km/h
    if setting == 4:
        startCalorie = 120
        calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
    #       - 4: Running 15 km/h
    if setting == 5:
        startCalorie = 150
        calorieTotal = (startCalorie * ((clientWeight/startWeight)-1)) + startCalorie
    # Calculating the amount of burned calories with the time the client actually ran
    actualCalorie = (int(calorieTotal) * sportTime)
    actualCalorie = int(actualCalorie)
    print(actualCalorie, "Kcal")
    gD.insertData('customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
              '{}, \'{}\', \'{}\', \'Rowing Machine\', {}'.format(ID, startTime, endTime, actualCalorie))
import getData as gD
import time

customerID = 1
startTime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
endTime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
device = 'x'
actualCalories = 10

getWeight = gD.getDataWhere('weight', 'customerInfo', customerID)

gD.insertData(
    'customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
    '{}, \'{}\', \'{}\', \'{}\', {}'.format(customerID, startTime, endTime,
                                            device, actualCalories))
Пример #18
0
def getcustomerId():
    ID = gD.getDataWhere('customerID', 'loginInfo',
                         'RFIDNumber={}'.format(str(cardData)))
    return ID
Пример #19
0
def sendInformation(firstName, surname, street, addressNumber, postalCode,
                    town, country, phoneNumber, email, password, weight, IBAN):
    """
        This function first checks if any of the forms are empty.
        After that it tells you to hold the access card to the reader and it will write the information to the database.
    """
    global window, backData, scanPass
    gender = genderEntry.get(
    )  #create a gender variable to use inside this function

    if IBAN == "" or firstName == "" or surname == "" or street == "" or addressNumber == "" or postalCode == "" or town == "" or country == "" or phoneNumber == "" or gender == " " or email == "" or password == "" or weight == "":
        message.showinfo(
            "Information missing",
            "At least one input box is still empty. Please make sure you filled in al the required information."
        )

    else:
        try:
            scanPassScreen("top")
            thread = threading.Thread(
                target=reader, args=(True, )
            )  #create a thread to scan access cards while having a window open
            thread.start()
            scanPass.mainloop()

            cardData = backData
            backData = ""

            cardDataDb = ("rfidNumber='" + str(cardData) + "'")
            checkRFIDData = gD.getDataWhere("count(*)", "loginInfo",
                                            cardDataDb)

            if checkRFIDData[0][0] == 0:
                gD.insertInto(
                    "customerInfo",
                    "surname, name, gender, cellphoneNumber, weight, IBAN",
                    "'{}', '{}', '{}', '{}', {}, '{}'".format(
                        surname, firstName, gender, phoneNumber, weight, IBAN))
                gD.insertInto(
                    "addressInfo",
                    "street, zipcode, addressNumber, town, country",
                    "'{}', '{}', '{}', '{}', '{}'".format(
                        street, postalCode, addressNumber, town, country))
                gD.insertInto(
                    "loginInfo", "password, email, rfidNumber",
                    "'{}', '{}', '{}'".format(password, email, str(cardData)))

                message.showinfo("It worked",
                                 "U are hereby a customer of benno's gym.")

                IBANEntry.delete(0, END)
                firstNameEntry.delete(0, END)
                surnameEntry.delete(0, END)
                streetEntry.delete(0, END)
                addressNumberEntry.delete(0, END)
                postalCodeEntry.delete(0, END)
                townEntry.delete(0, END)
                countryEntry.delete(0, END)
                phoneNumberEntry.delete(0, END)
                emailEntry.delete(0, END)
                genderEntry.set(" ")
                passwordEntry.delete(0, END)
                weightEntry.delete(0, END)

            else:
                message.showinfo(
                    "Already in use",
                    "This access card is already registered. Try a different one"
                )
                sendInformation(firstName, surname, street, addressNumber,
                                postalCode, town, country, phoneNumber, email,
                                password, weight, IBAN)
        except:
            message.showinfo("Failed",
                             "Something went wrong. Please try again later.")
Пример #20
0
def  getcustomerId():
	ID = gD.getDataWhere('customerID', 'loginInfo', 'RFIDNumber={}'.format(str(cardData)))
	return ID
import getData as gD
import time

customerID = 1
startTime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
endTime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
device = 'x'
actualCalories = 10

getWeight = gD.getDataWhere('weight', 'customerInfo', customerID)

gD.insertData('customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
              '{}, \'{}\', \'{}\', \'{}\', {}'.format(customerID, startTime, endTime, device, actualCalories))