Browse Source

fixes #14

pull/18/head
James Mc Dermott 3 years ago
committed by GitHub
parent
commit
00e2c7aba5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 7 deletions
  1. +19
    -7
      scripts/index.py

+ 19
- 7
scripts/index.py View File

@@ -48,24 +48,36 @@ def setup_options():
help="displays the status of rooms in the Henry Grattan building")
return parser

def get_data():
times, c, g, details = {'0800': '1', '0830': '2', '0900': '3', '0930': '4', '1000': '5', '1030': '6', '1100': '7', '1130': '8', '1200': '9', '1230': '10', '1300': '11', '1330': '12', '1400': '13','1430': '14', '1500': '15', '1530': '16', '1600': '17', '1630': '18', '1700': '19', '1730': '20', '1800': '21', '1830': '22', '1900': '23', '1930': '24', '2000': '25', '2030': '26', '2100': '27', '2130': '28', '2200': '29', '2230': '30'}, ['LG25', 'LG26', 'LG27', 'L101', 'L114', 'L125', 'L128'], ['CG01', 'CG02', 'CG03', 'CG04', 'CG05', 'CG06', 'CG11', 'CG12', 'CG20', 'CG68', 'C166'], sys.argv[2:]
return times, c, g, details

def get_lst(c, g, options):
if options.computing: lst = c
elif options.grattan: lst = g
return lst

def opt_is_room(options, rooms, details, times):
c, g = rooms[0:2]
if options.computing: lst = c
elif options.grattan: lst = g
else:
controls.lookup_room_control(g, c, details, times)

def main():
parser = setup_options()
(options, arguments) = parser.parse_args()
times, c, g, details = {'0800': '1', '0830': '2', '0900': '3', '0930': '4', '1000': '5', '1030': '6', '1100': '7', '1130': '8', '1200': '9', '1230': '10', '1300': '11', '1330': '12', '1400': '13','1430': '14', '1500': '15', '1530': '16', '1600': '17', '1630': '18', '1700': '19', '1730': '20', '1800': '21', '1830': '22', '1900': '23', '1930': '24', '2000': '25', '2030': '26', '2100': '27', '2130': '28', '2200': '29', '2230': '30'}, ['LG25', 'LG26', 'LG27', 'L101', 'L114', 'L125', 'L128'], ['CG01', 'CG02', 'CG03', 'CG04', 'CG05', 'CG06', 'CG11', 'CG12', 'CG20', 'CG68', 'C166'], sys.argv[2:]
times, c, g, details = get_data()
if options.book:
print("Booking requires more arguments. See the help for details.") if len(details) < 4 else controls.booking_control(c, g, details)
sys.exit()
elif len(details) > 5:
print("Too many arguments passed.")
elif options.lookup:
if options.computing: lst = c
elif options.grattan: lst = g
else:
controls.lookup_room_control(g, c, details, times)
opt_is_room(options, (c, g), details, times)
controls.lookup_building_control(options, lst, details, times)
elif options.now:
if options.computing: lst = c
elif options.grattan: lst = g
lst = get_lst(c, g, options)
controls.available_now_control(options, lst, times)
else:
parser.print_help()


Loading…
Cancel
Save