Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mzanella committed Dec 9, 2017
1 parent 6875503 commit 12ef5a3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
python-telegram-bot==8.1.1
requests
lxml
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ def parse(self, room):
def parseSchedule(self, room):
return Scedule(room, self.parse(room))

schedule = URLParser().parseSchedule('1A150')
print(schedule)
#schedule = URLParser().parseSchedule('1A150')
#print(schedule)
38 changes: 19 additions & 19 deletions torrearchimedebot/bot/handlers/room_handler.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
from .abs_handler import AbsHandler
from ../parsing import *
from .parsing import *

class RoomHandler(AbsHandler):
class RoomHandler:

def __init__(self, roomId):
self.roomId = roomId

def handleMessage(self):
return schedulePrettyfier(URLParser().parseSchedule(self.roomId))

def schedulePrettyfier(scheduleObj):
schedule = scheduleObj.getSchedule()
toReturn = ''
if (not schedule):
toReturn = "The room is always empty today!"
else:
delimiter = " "
for time in schedule:
activity = schedule[time]
stop = 2
if (activity[2] == '')
stop = 1
toReturn += time
for i in range(0, stop):
toReturn = delimiter + activity[i]
toReturn += "\n"
return toReturn
def schedulePrettyfier(scheduleObj):
schedule = scheduleObj.getSchedule()
toReturn = ''
if (not schedule):
toReturn = "The room is always empty today!"
else:
delimiter = " "
for time in schedule:
activity = schedule[time]
stop = 2
if (activity[2] == ''):
stop = 1
toReturn += time
for i in range(0, stop):
toReturn = delimiter + activity[i]
toReturn += "\n"
return toReturn

0 comments on commit 12ef5a3

Please sign in to comment.