Coursework-II-The-Prototype / bill_spliting_system

0 stars 0 forks source link

Task 3 #3

Open cxy-254 opened 1 week ago

cxy-254 commented 1 week ago

Goal:

Loop through every order in order database (refer to the database structure created by Task1), if the ready state (e.g. isReady) of all users in an order is true, and they have enough balance to pay the order, move the order to the preparation database.

YidingWang05 commented 1 week ago

I have finished in shopping.py. Before any further progress, the following tasks must be finished

YidingWang05 commented 6 days ago

@Infinity0708 I updated the shopping.py file, added a new function id_check(). You can use this function to ask user input their house id and student id and have those ids checked as well.

def id_check():

input1 = input("Enter your house hold id please: ")
house_id_input = int(input1)
 house = household_and_user.get(household.house_id == house_id_input)

if house:
    print("House found! ")
    input2 = input("Enter your student id: ")
    student_id_input = int(input2)
    student_ids = house.get("student_id", [])

    if student_id_input in student_ids:
        print("Student id found! ")
        return house, student_ids, True
    else:
        return 0, 0, False
else:
    print("Cannot found house or student id, check your input")
    return 0, 0, False`

The return of this function is in the format of house_id, student_id, is_input_valid. The first two variables are ints and the last one is boolean. The last id is used to indicate if the inputted ids are in the househole db.

NOTE: This function has NOT been tested yet!! This is because of the incompleteness of task 1. Thus, please keep an eye on any further updates to this function or shopping.py.