def treadmill():
    """
    This function is a calorietracker for running on a treadmill with different settings for the speed of the runner
    """
    global setting
    clientWeight = 85  # This value should be acquired out of the database
    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 = calorieTotal * timeHours
    actualCalorie = int(actualCalorie)
    print(actualCalorie, "Kcal")
    gD.insertData('customerPerformanceInfo (customerID, startSession, endSession, fitnessDevice, burntCalories)',
              '{}, \'{}\', \'{}\', \'Rowing Machine\', {}'.format(ID, startTime, endTime, actualCalorie))
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 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))
示例#4
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))
def spinningMachine():
    """
    This function is used to count the amount of calories the client uses while spinning
    """
    clientWeight = 70
    startWeight = 10
    global sportTime
    hourTime = sportTime / 60
    # Spinning has only one setting
    startCalorie = 117
    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 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))
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))
示例#8
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))
示例#9
0
def spinningMachine():
    """
    This function is used to count the amount of calories the client uses while spinning
    """
    clientWeight = 70
    startWeight = 10
    global sportTime
    hourTime = sportTime / 60
    # Spinning has only one setting
    startCalorie = 117
    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))
示例#10
0
def treadmill():
    """
    This function is a calorietracker for running on a treadmill with different settings for the speed of the runner
    """
    global setting
    clientWeight = 85  # This value should be acquired out of the database
    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 = calorieTotal * timeHours
    actualCalorie = int(actualCalorie)
    print(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 = 70
    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))
示例#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))
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))
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))

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))