Commit b8b47acc authored by Jack Otto's avatar Jack Otto
Browse files

11/18/21 parse json form

parent 99d582ac
ncl43ti7kan2388rfu6vunrdvk
sleuk0a6enon1bcptkll65r868
om464m1lirvfu6t2ruhonsd4ag
iv0hd87pjd8ptr1ji5p5u79d9k
ej8qqjof4bdphodmo2l07jpgdo
btinklbegsucjg519fdvhula54
u0n64fha4kmehngnvc0otqjcoc
5euh3k0rtqe3nv5ki81ptcl7fc
dgcj4khu7u4gl4ci3escqvqm0s
k87gb41d6uthjidpra4iq6ecb0
krgq2c1th64oalufrkpk66s1v8
srjroruip2tg7lce69rs3nl2ig
cr0ooqjos5pnhlsau8vf1u10lc
62lihip2nu5da57stmi7hcef6s
l9d14kv10kjok4f7fmmntevaeo
i0k0ce9ekudvuuufr0rh8m6c34
ndqcgqs9733re411j2rftbuprk
in8ekbdnoc8a6j13o8s7pdbjv0
ngrut2m8s5rse89tindu6s73po
4i97jl2g9q3uioq8j7t822b7a0
rsgv2acfhbp5u0tvpb4du6p28k
e1m8fvk5gqv3pqrv3ouv2r4e9c
1u90rpr2forunvfs7tibfgu928
2alc4stsvqeuktuf8va6vcjhqc
qgrour7g0l45r7vatvsgomkldo
fr6fq9113avbrcajdnusk3rl5c
u34up34jr9kjn0eb3gn53ft1do
oropdf82l3ql7o6k5cbbu9plmo
1n2s3luf5rbhdoqidppnnlmifk
c8joj06e7nv1hs3gdibdf29hss
1o3rjuds14ufuamsmejv258ifk
52camsumbe4au4tj0ac1ebaugk
37nasfsc8uavu5nqaueemk4q78
19qnk7t7aja0l70lg3jlbnjf78
as1d3m1k8nk1d6n170csnj3v98
dgititebi0jca1731rehjrcev8
ar5c40o77e3ucu3vmjjooudmls
q8hi93nrdd3jr4qeksadqc493k
2r2s1b9f43lm2o1pf4iu3iai0g
k244sbjvb1dopan8pmaom49fg4
m5gs585s321l0kevlt6c1hps7o
k8oqu87ndsmoatnhi4f2bjlubs
ca3o9jn63jbt6s2l1no3fvdih0
1h0n5j2o0nft378pain1c8cep8
88j4bt601arsbnev7uadvcjpgg
e4b4a65psbuoacj329cma7t7uo
66ab528nfuu51uaul88cgl5qb8
6ofmarmkhcffpbf2siursjvbdc
0lmh2eejsmmkmbgtlciaaapul8
jr3qi9tas4ekn3f64t5pou7i40
qe051g0854e2ulivbnql00ltrc
dgbkbn3jrsr14qg5atj152iuqg
bttdanl5m3ssnpdcaet05fbnec
lbieiqggi2m3ps5sjgi2r5qa3c
id5hdd8lplrdb0b4vtlr0m1udk
1vs8kb9fjn88mr70bqdlojl1n8
r8to2v4s379kv4fosrk90urlko
1jm02qn9mrfj6p366kk6ce7duo
e6o7cbs565itjrqooephektpm4
7rkf2pedl1ppsfrjde4j9r5db4
o97rai688hi3nbhe84koslp7u4
ebvueih4akc9enmjgouhh1s9r4
jfs257glsncr69j95hn3rdf2do
k0l0h461ubhuqajh6jfvrc2dq8
aujhsv2dcj6hid9aij5girb3ao
cbvp6bks765ahdciq8mgrlju9g
ucqufmu1qvo6k7pnb7b2g0b3c8
hffp0qagc8hpjaoobaniv5bguk
npuf7i31064jse2sd61c7j0tas
477najr411diuh6i51qjff7c28
8idu1jdmtga9pipathqiqg0ico
7drd2cqt07l534iejvf01r201k
1frmrmcg6e9lkr6komri6tmlag
d72palp0ibg6810nnsdf21o76g
kr6mvupb3fd4co200lrb2ubja0
...@@ -196,7 +196,7 @@ def full_schedule(): ...@@ -196,7 +196,7 @@ def full_schedule():
model.Add(scheduled_classes[n, c, p, "Th", "14"] == 0) model.Add(scheduled_classes[n, c, p, "Th", "14"] == 0)
print("Adding constraint for senior design class room common hour to be blocked off") print("Adding constraint for senior design class room common hour to be blocked off")
for c in courses: for c in rooms:
if c == "DANA137" or c == "DANA115": if c == "DANA137" or c == "DANA115":
for n in courses: for n in courses:
for p in profs: for p in profs:
......
No preview for this file type
...@@ -47,7 +47,8 @@ def add_hard_constriant(): ...@@ -47,7 +47,8 @@ def add_hard_constriant():
return render_template("calendar.html") return render_template("calendar.html")
else: ## POST else: ## POST
print(request.form) print(request.form)
parse_constraint(request.form) conlist = parse_constraint(request.form)
#for con in conlist addardcon
return render_template("calendar.html") return render_template("calendar.html")
@app.route("/popup") @app.route("/popup")
...@@ -78,43 +79,50 @@ def parse_constraint(dict): ...@@ -78,43 +79,50 @@ def parse_constraint(dict):
for keys in keylist: for keys in keylist:
for values in dict.getlist(keys): for values in dict.getlist(keys):
valuelist.append(values) valuelist.append(values)
print(values)
#gets all the days #gets all the days
for day in dict.getlist("Day"): for day in dict.getlist("Day"):
daylist.append(day) daylist.append(day)
global class_index constraint_list = []
#find index of the class from inputs
print("searching for " + valuelist[1])
for i in range(len(spring_2022_inputs.classes)):
if spring_2022_inputs.classes[i][0] == valuelist[1]:
class_index = i
print(class_index)
break
global room_index
# find index of the room from inputs
print("searching for " + valuelist[2])
for i in range(len(spring_2022_inputs.classrooms)):
if spring_2022_inputs.classrooms[i][0] == valuelist[2]:
room_index = i
print(room_index)
break
global prof_index
# find index of the prof from inputs
print("searching for " + valuelist[0])
for i in range(len(spring_2022_inputs.professors)):
if spring_2022_inputs.professors[i][0] == valuelist[0]:
prof_index = i
print(prof_index)
break
# #make the model.add command
for i in range(len(daylist)): for i in range(len(daylist)):
# model.Add(scheduled_classes[(courses[1], rooms[0], profs[4], "Mo", "10")] == 1) constraint_list.append([valuelist[1], valuelist[2], valuelist[0], daylist[i], valuelist[3+len(daylist)]])
print("model.Add(scheduled_classes[(courses[" + str(class_index) + "], rooms[" + str(room_index) + "], profs[" + str(prof_index) + "], " + '"' + daylist[i] + '"' + ", " + '"' + valuelist[3+len(daylist)] + '"' + ")] == 1)")
return constraint_list
# global class_index
# #find index of the class from inputs
# print("searching for " + valuelist[1])
# for i in range(len(spring_2022_inputs.classes)):
# if spring_2022_inputs.classes[i][0] == valuelist[1]:
# class_index = i
# print(class_index)
# break
#
# global room_index
# # find index of the room from inputs
# print("searching for " + valuelist[2])
# for i in range(len(spring_2022_inputs.classrooms)):
# if spring_2022_inputs.classrooms[i][0] == valuelist[2]:
# room_index = i
# print(room_index)
# break
#
# global prof_index
# # find index of the prof from inputs
# print("searching for " + valuelist[0])
# for i in range(len(spring_2022_inputs.professors)):
# if spring_2022_inputs.professors[i][0] == valuelist[0]:
# prof_index = i
# print(prof_index)
# break
#
#
# # #make the model.add command
# for i in range(len(daylist)):
# # model.Add(scheduled_classes[(courses[1], rooms[0], profs[4], "Mo", "10")] == 1)
# print("model.Add(scheduled_classes[(courses[" + str(class_index) + "], rooms[" + str(room_index) + "], profs[" + str(prof_index) + "], " + '"' + daylist[i] + '"' + ", " + '"' + valuelist[3+len(daylist)] + '"' + ")] == 1)")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment