Make 'unbook' available for all
The ability to unbook rooms should be accessible to all users. Change-Id: If747141f9cfc1cd74b542071a798cf94ff1db309
This commit is contained in:
parent
894c8672e8
commit
57d849493b
12
README.rst
12
README.rst
|
@ -79,6 +79,15 @@ you can use book the room. Example usage::
|
||||||
you can use the ``now`` and ``next`` commands to communicate what topic
|
you can use the ``now`` and ``next`` commands to communicate what topic
|
||||||
is being discussed.
|
is being discussed.
|
||||||
|
|
||||||
|
unbook
|
||||||
|
------
|
||||||
|
|
||||||
|
The ``unbook`` command is used to free up booked slots in the additional rooms.
|
||||||
|
You should generally not unbook a track without the consent of its track lead.
|
||||||
|
Example usage::
|
||||||
|
|
||||||
|
#vitrage unbook Missouri-MonAM
|
||||||
|
|
||||||
clean
|
clean
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
@ -127,9 +136,6 @@ You have to be a channel operator (+o) to use admin commands.
|
||||||
~clean TRACK [TRACK..]
|
~clean TRACK [TRACK..]
|
||||||
Removes active entries for specified track(s)
|
Removes active entries for specified track(s)
|
||||||
|
|
||||||
~unbook SLOTCODE
|
|
||||||
Removes any booking at the slot named SLOTCODE
|
|
||||||
|
|
||||||
~newday
|
~newday
|
||||||
Removes now/next/location entries, to be run at the start of a new day
|
Removes now/next/location entries, to be run at the start of a new day
|
||||||
|
|
||||||
|
|
|
@ -140,8 +140,19 @@ class PTGBot(SASL, SSL, irc.bot.SingleServerIRCBot):
|
||||||
self.send(chan, "%s: Room %s is now booked on %s for %s" %
|
self.send(chan, "%s: Room %s is now booked on %s for %s" %
|
||||||
(nick, room, timeslot, track))
|
(nick, room, timeslot, track))
|
||||||
else:
|
else:
|
||||||
self.send(chan, "%s: invalid slot reference '%s'" %
|
self.send(chan, "%s: slot '%s' is invalid (or booked)" %
|
||||||
(nick, params))
|
(nick, params))
|
||||||
|
elif adverb == 'unbook':
|
||||||
|
room, sep, timeslot = params.partition('-')
|
||||||
|
if self.data.is_slot_booked_for_track(track, room, timeslot):
|
||||||
|
self.data.unbook(room, timeslot)
|
||||||
|
self.send(chan, "%s: Room %s (previously booked for %s) "
|
||||||
|
"is now free on %s" %
|
||||||
|
(nick, room, track, timeslot))
|
||||||
|
else:
|
||||||
|
self.send(chan, "%s: slot '%s' is invalid "
|
||||||
|
"(or not booked for %s)" %
|
||||||
|
(nick, params, track))
|
||||||
else:
|
else:
|
||||||
self.send(chan, "%s: unknown directive '%s'" % (nick, adverb))
|
self.send(chan, "%s: unknown directive '%s'" % (nick, adverb))
|
||||||
self.usage(chan)
|
self.usage(chan)
|
||||||
|
@ -163,10 +174,6 @@ class PTGBot(SASL, SSL, irc.bot.SingleServerIRCBot):
|
||||||
self.send(chan, "Done.")
|
self.send(chan, "Done.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.send(chan, "Error loading DB: %s" % e)
|
self.send(chan, "Error loading DB: %s" % e)
|
||||||
elif command == 'unbook':
|
|
||||||
params = str.join(' ', words[1:])
|
|
||||||
room, sep, timeslot = params.partition('-')
|
|
||||||
self.data.unbook(room, timeslot)
|
|
||||||
elif command == 'newday':
|
elif command == 'newday':
|
||||||
self.data.new_day_cleanup()
|
self.data.new_day_cleanup()
|
||||||
elif command == 'requirevoice':
|
elif command == 'requirevoice':
|
||||||
|
|
|
@ -138,6 +138,12 @@ class PTGDataBase():
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def is_slot_booked_for_track(self, track, room, timeslot):
|
||||||
|
try:
|
||||||
|
return self.data['schedule'][room][timeslot] == track
|
||||||
|
except KeyError:
|
||||||
|
return False
|
||||||
|
|
||||||
def book(self, track, room, timeslot):
|
def book(self, track, room, timeslot):
|
||||||
self.data['schedule'][room][timeslot] = track
|
self.data['schedule'][room][timeslot] = track
|
||||||
self.save()
|
self.save()
|
||||||
|
|
Loading…
Reference in New Issue