Fetch missing data for repair jobs on creation
drklee3 opened this issue · comments
Create a RepairJob for a car when it is brought in. This will have information for all the fields except for time_out(the datetime when the car is ready to be picked up), the problems ids associated with the car, labor hours, name and the cost of the parts used
UI apparently won't have the following fields provided by the user:
- time_out
- problem ids
- labor hours
- name / cost of parts
So in order to assign problems to a RepairJob we have a set number of problems.
To create n random problems, generate a random number n and for each of those n problems get a random problem. Then insert each (problem_id, repair_id) into repair_problems.
Pseudocode
def assign_problems(repair_id, problems_list):
# random number of problems, upper bound could be anything
num_problems = randint(0, 5)
for i in num_problems:
# rand between 0 to length
prob_id = randint(0, len(problems_list))
insert_into_problems(repair_id, prob_id)