Closed SudoSu-bham closed 11 months ago
nice work, some points:
We can merge these two messages
Now that class schedule can be fetched for a specific day, we should maybe just give a preview of the day we're fetching for in this message:
We can add more contextual information like
🟢🟢🟢🟢
Schedule for Mon, 25 Oct:
...
Perhaps just add today's date in the Select Date
message so the width of the button map increases
@achintya-7 any inputs?
How about we get the current month and display number of dates according to it.
A switch or match statement with a function can be used (Can decouple the build calendar for loop).
How about we get the current month and display number of dates according to it.
Looks like the code is already doing that:
def create_calendar_markup():
today = datetime.date.today()
year = today.year
month = today.month
dates = []
global list_dates
list_dates = []
first_day = datetime.date(year, month, 1)
last_day = datetime.date(year, month + 1, 1) - datetime.timedelta(days=1)
for day in range(1, last_day.day + 1):
date = datetime.date(year, month, day)
dates.append(InlineKeyboardButton(str(day), callback_data=date.strftime("%Y-%m-%d")))
list_dates.append(date.strftime("%Y-%m-%d"))
return InlineKeyboardMarkup([dates[i:i + 7] for i in range(0, len(dates), 7)])
A switch or match statement with a function can be used (Can decouple the build calendar for loop).
Could work on it later imo, some other parts of the codebase need to be refactored. Rn lets focus on how to present everything if functionality is there
Looks perfect to me. Just add this to util. Let's keep the telegram-handler a bit clear and to the point.
@Maniktherana We can add point 1 and 2 so that it look nice if someone is fetching the schedule using calendar. I will try to make calendar look more appealing.
@Maniktherana We can add point 1 and 2 so that it look nice if someone is fetching the schedule using calendar. I will try to make calendar look more appealing.
Sounds good, just try to format dates like Mon, 25 Oct
wherever possible
The markup size of calendar has been increased and the output of class schedule message also looks good now. here is the image
The showing schedule for
text should come after the dots and might as well remove the class schedule
text under the dots. Consider making a separate formatter or adding optional kwargs to the class schedule formatter.
Other than that looks fine.
updated
looks good, remove draft when ready for review
Updated the telegram_handler file moved everything to the util folder, Also the calendar output is changed. Also the calendar markup method is made faster by reducing the execution time to O(1), if the function is called repetitively.
close #29 The Amibot-tg can now show the class schedule of any dates in current month. This was a long-awaited feature. here is the image of the output