Skip to content

Commit

Permalink
Fix: wrong dates in zh_trashbot
Browse files Browse the repository at this point in the history
Fixed a bug in the code querying collection dates. Apparently,
collection dates are not automatically sorted by date. Turned on the
respective flag.
  • Loading branch information
romanc committed Oct 22, 2020
1 parent 114e0a9 commit cbd4d99
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/trashbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import re
import urllib.request

from datetime import datetime, date
from datetime import datetime
from telegram import InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import CallbackQueryHandler, CommandHandler,\
ConversationHandler, Filters, MessageHandler, PicklePersistence, Updater
Expand Down Expand Up @@ -92,8 +92,8 @@ def button(update, context):
limit = 1

baseurl = "http://openerz.metaodi.ch/api/calendar"
openerz = "%s/%s.json?zip=%s&start=%s&limit=%s" % (baseurl, query.data,
zip, today, limit)
openerz = "%s/%s.json?sort=date&zip=%s&start=%s&limit=%s" % (baseurl,
query.data, zip, today, limit)

with urllib.request.urlopen(openerz) as url:
data = json.loads(url.read().decode())
Expand Down

0 comments on commit cbd4d99

Please sign in to comment.