From 5c55641640539a8a2628959d4bbbf3c0a7c8ae19 Mon Sep 17 00:00:00 2001 From: Christian Heller <c.heller@plomlompom.de> Date: Mon, 11 Dec 2023 07:14:26 +0100 Subject: [PATCH] Further improvements to todo accounting. --- todo.py | 333 +++++++++++++++++++++----------------------------------- 1 file changed, 124 insertions(+), 209 deletions(-) diff --git a/todo.py b/todo.py index d4ca1e7..88684ac 100644 --- a/todo.py +++ b/todo.py @@ -8,20 +8,23 @@ from urllib.parse import urlparse db_path = '/home/plom/org/todo_new.json' # db_path = '/home/plom/public_repos/misc/todo_new.json' server_port = 8082 +DATE_FORMAT = '%Y-%m-%d' html_head = """ <style> -tr:nth-child(even) { +table.alternating tr:nth-child(even) { background-color: #f2f2f2; } -tr:nth-child(odd) { +table.alternating tr:nth-child(odd) { background-color: #ffffff; } th, td { border: 1px solid black; text-align: left; vertical_align: top; } td details { display: inline } td.input { width: 100%; } -td.checkbox { width: 1.5em; } -th.checkbox { width: 1.5em; } +td.checkbox { width: 0.7em; } +th.checkbox { width: 0.7em; } +tr.week_row td { height: 0.1em; border: 0px; background-color: black; } +tr.day_row td { background-color: #f2f2f2; } input[type="text"] { width: 100%; box-sizing: border-box; } </style> <body> @@ -32,14 +35,19 @@ tasks: <a href="{{db.prefix}}/tasks">list</a> <a href="{{db.prefix}}/add_task">a <hr /> """ form_footer = '\n</form>' - form_header_tmpl = """ <form action="{{action|e}}" method="POST"> """ calendar_tmpl = """ +<p> +from: <input name="start" {% if start_date %}value="{{ start_date }}"{% endif %} placeholder="{{ today }}" /> +to: <input name="end" {% if end_date %}value="{{ end_date }}"{% endif %} placeholder="2030-12-31" /> +<input type="submit" value="OK" /> +</p> <table> -{% for date, day in days.items() | sort(reverse=True) %} -<tr><td colspan=3><a href="{{db.prefix}}/day?date={{date}}&hide_unchosen=1">{{ date }}</a> {{ day.weekday }} ({{ day.todos_sum|round(2) }}) {{ day.comment|e }}</td></tr> +{% for date, day in days.items() | sort() %} +{% if day.weekday == "Monday" %}<tr class="week_row"><td colspan=3></td></tr>{% endif %} +<tr class="day_row"><td colspan=3><a href="{{db.prefix}}/day?date={{date}}&hide_unchosen=1">{{ date }}</a> {{ day.weekday }} ({{ day.todos_sum|round(2) }}) {{ day.comment|e }}</td></tr> {% for task, todo in day.todos.items() | sort(attribute='1.title', reverse=True) %} {% if todo.visible %} <tr><td class="checkbox">{% if todo.done %}â{% else %} {% endif %}</td><td><a href="{{db.prefix}}/todo?task={{ todo.task.id_ }}&date={{ date }}">{{ todo.title }}</a></td><td>{{ todo.comment|e }}</td></tr> @@ -70,38 +78,19 @@ task_tmpl = """ </table> <input type="submit" value="update" /> """ -# archived_days_tmpl = """ -# <table> -# {% for date, day in days.items() | sort(reverse=True) %} -# {% if day.archived %} -# <tr><td>{{ date }} {{ day.weekday }} ({{ day.todos_sum|round(2) }}) {{ day.comment|e }} <input type="submit" name="edit_{{date}}" value="edit" /></td></tr> -# {% for task, todo in day.todos.items() | sort(attribute='1.title', reverse=True) %} -# <tr><td>{{ todo.title }}</td><td>{% if todo.done %}â{% endif %}</td><td>{{ todo.weight }}</td></tr> -# {% endfor %} -# {% endif %} -# {% endfor %} -# </table> -# """ day_tmpl = """ -<input type="submit" value="OK"> -hide unchosen: <input name="hide_unchosen" type="checkbox" {% if db.hide_unchosen %}checked{% endif %} /><br /> -mandatory tags: {% for t_tag in db.t_tags | sort %} -<input name="t_filter_and" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_and %} checked {% endif %} >{{ t_tag }} -{% endfor %} -<br /> -forbidden tags: {% for t_tag in db.t_tags | sort %} -<input name="t_filter_not" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_not %} checked {% endif %} >{{ t_tag }} -{% endfor %} -</p> - <p> +<input name="hide_unchosen" type="checkbox" {% if db.hide_unchosen %}checked{% endif %} /> hide unchosen | +<a href="{{db.prefix}}/day?date={{prev_date}}{% if db.hide_unchosen %}&hide_unchosen=1{% endif %}">prev</a> <a href="{{db.prefix}}/day?date={{next_date}}{% if db.hide_unchosen %}&hide_unchosen=1{% endif %}">next</a> | <input type="hidden" name="original_selected_date" value="{{ db.selected_date }}" /> -<a href="{{db.prefix}}/day?date={{prev_date}}{% if db.hide_unchosen %}&hide_unchosen=1{% endif %}">prev</a> <a href="{{db.prefix}}/day?date={{next_date}}{% if db.hide_unchosen %}&hide_unchosen=1{% endif %}">next</a> date: <input name="new_selected_date" value="{{ db.selected_date }}" size=8 /> {{ db.selected_day.todos_sum|round(2) }} ({{ db.selected_day.todos_sum2|round(2)}}) comment: <input name="comment" value="{{ db.selected_day.comment|e }}"> +date: <input name="new_selected_date" value="{{ db.selected_date }}" size=8 /> | +{{ db.selected_day.todos_sum|round(2) }} ({{ db.selected_day.todos_sum2|round(2)}}) | +comment: <input name="day_comment" value="{{ db.selected_day.comment|e }}"> </p> -<table> +<table class="alternating"> <tr><th>task</th><th class="checkbox">choose?</th><th class="checkbox">done?</th><th>weight</th><th>comment</th></tr> -{% for uuid, t in db.tasks.items() | sort(attribute='1.title', reverse=True) %} +{% for uuid, t in db.tasks.items() | sort(attribute='1.title') %} {% if t.visible %} <tr> <input name="t_uuid" value="{{ uuid }}" type="hidden" > @@ -116,19 +105,48 @@ forbidden tags: {% for t_tag in db.t_tags | sort %} </table> <input type="submit" value="OK"> """ -tasks_tmpl = """ +tag_filters_tmpl = """ +<p style="float: left; margin-right: 1em;"> +<input type="submit" value="OK"> +</p> <p> -<input type="submit" value="OK"> mandatory tags: {% for t_tag in db.t_tags | sort %} -<input name="t_filter_and" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_and %} checked {% endif %} >{{ t_tag }} +mandatory tags: +{% for and_filter in db.t_filter_and %} +<select name="t_and"> +<option></option> +{% for tag in db.t_tags | sort %} +<option value="{{tag|e}}" {% if and_filter == tag %}selected{% endif %}>{{tag|e}}</option> +{% endfor %} +</select> +{% endfor %} +<select name="t_and"> +<option></option> +{% for tag in db.t_tags | sort %} +<option value="{{tag|e}}">{{tag|e}}</option> {% endfor %} +</select> <br /> -forbidden tags: {% for t_tag in db.t_tags | sort %} -<input name="t_filter_not" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_not %} checked {% endif %} >{{ t_tag }} +forbidden tags: +{% for not_filter in db.t_filter_not %} +<select name="t_not"> +<option></option> +{% for tag in db.t_tags | sort %} +<option value="{{tag|e}}" {% if not_filter == tag %}selected{% endif %}>{{tag|e}}</option> {% endfor %} +</select> +{% endfor %} +<select name="t_not"> +<option></option> +{% for tag in db.t_tags | sort %} +<option value="{{tag|e}}">{{tag|e}}</option> +{% endfor %} +</select> </p> -<table> +""" +tasks_tmpl = """ +<table class="alternating"> <tr><th>default<br />weight</th><th>task</th><th>tags</th></tr> -{% for uuid, t in db.tasks.items() | sort(attribute='1.title', reverse=True) %} +{% for uuid, t in db.tasks.items() | sort(attribute='1.title') %} {% if t.visible %} <tr> <td>{{ t.default_weight }}</a></td> @@ -138,41 +156,6 @@ forbidden tags: {% for t_tag in db.t_tags | sort %} {% endfor %} </table> """ -# selected_day_tmpl = """ -# <p> -# hide unchosen: <input name="hide_unchosen" type="checkbox" {% if db.hide_unchosen %}checked{% endif %} /><br /> -# mandatory tags: {% for t_tag in db.t_tags | sort %} -# <input name="t_filter_and" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_and %} checked {% endif %} >{{ t_tag }} -# {% endfor %} -# <br /> -# forbidden tags: {% for t_tag in db.t_tags | sort %} -# <input name="t_filter_not" type="checkbox" value="{{ t_tag }}" {% if t_tag in db.t_filter_not %} checked {% endif %} >{{ t_tag }} -# {% endfor %} -# </p> -# -# <p> -# <input type="hidden" name="original_selected_date" value="{{ db.selected_date }}" /> -# date: <input name="new_selected_date" value="{{ db.selected_date }}" size=8 /> {{ db.selected_day.todos_sum|round(2) }} ({{ db.selected_day.todos_sum2|round(2)}}) comment: <input name="comment" value="{{ db.selected_day.comment|e }}"> -# </p> -# -# <table> -# <tr><th>default<br />weight</th><th>title</th><th>tags</th><th>choose?</th><th>done?</th><th>day<br />weight</th></tr> -# {% for uuid, t in db.tasks.items() | sort(attribute='1.title', reverse=True) %} -# {% if t.visible %} -# <input name="t_uuid" value="{{ uuid }}" type="hidden" > -# <tr> -# <td><input name="t_default_weight" value="{{ t.default_weight }}" type="number" step=0.1 size=5 required/></td> -# <td><input name="t_title" value="{{ t.title|e }}"/></td> -# <td><input name="t_tags" value="{{ t.tags_joined|e }}" > -# <td><input name="choose" type="checkbox" value="{{ uuid }}" {% if uuid in db.selected_day.todos.keys() %}checked{% endif %} ></td> -# <td><input name="done" type="checkbox" value="{{ uuid }}" {% if uuid in db.selected_day.todos.keys() and db.selected_day.todos[uuid].done %}checked{% endif %} ></td> -# <td colspan=2><input name="day_weight" type="number" step=0.1 size=5 value="{% if uuid in db.selected_day.todos.keys() and db.selected_day.todos[uuid].day_weight %}{{ db.selected_day.todos[uuid].day_weight }}{% endif %}" ></td> -# </tr> -# {% endif %} -# {% endfor %} -# </table> -# <input type="submit" value="OK"> -# """ class Task: @@ -364,14 +347,13 @@ class TodoDB(PlomDB): def __init__(self, prefix, selected_date=None, t_filter_and = None, t_filter_not = None, hide_unchosen=False): self.prefix = prefix self.selected_date = selected_date if selected_date else str(datetime.now())[:10] - self.t_filter_and = t_filter_and if t_filter_and else set() - self.t_filter_not = t_filter_not if t_filter_not else set() + self.t_filter_and = t_filter_and if t_filter_and else [] + self.t_filter_not = t_filter_not if t_filter_not else [] self.hide_unchosen = hide_unchosen self.days = {} self.tasks = {} self.t_tags = set() super().__init__(db_path) - self.switch_to_day() def read_db_file(self, f): d = json.load(f) @@ -387,8 +369,8 @@ class TodoDB(PlomDB): def to_dict(self): d = { - 't_filter_and': list(self.t_filter_and), - 't_filter_not': list(self.t_filter_not), + 't_filter_and': self.t_filter_and, + 't_filter_not': self.t_filter_not, 'tasks': {}, 'days': {} } @@ -400,20 +382,27 @@ class TodoDB(PlomDB): @property def selected_day(self): + if not self.selected_date in self.days.keys(): + self.days[self.selected_date] = self.add_day() return self.days[self.selected_date] + def change_selected_days_date(self, new_date): + if new_date in self.days.keys(): + raise PlomException('cannot use same date twice') + else: + self.days[new_date] = self.selected_day + del self.days[self.selected_date] + self.selected_date = new_date + def write(self): + dates_to_purge = [] + for date, day in self.days.items(): + if len(day.todos) == 0 and len(day.comment) == 0: + dates_to_purge += [date] + for date in dates_to_purge: + del self.days[date] self.write_text_to_db(json.dumps(self.to_dict())) - def switch_to_day(self, date=None): - if date: - self.selected_date = date - # if self.selected_date in self.days.keys(): - # self.selected_day.archived = True - if not self.selected_date in self.days.keys(): - self.days[self.selected_date] = self.add_day() - # self.selected_day.archived = False - def add_task(self, id_=None, dict_source=None, return_id=False): t = Task.from_dict(self, dict_source) if dict_source else Task(self) id_ = id_ if id_ else str(uuid4()) @@ -426,41 +415,33 @@ class TodoDB(PlomDB): def add_day(self, dict_source=None): return Day.from_dict(self, dict_source) if dict_source else Day(self) - # def show_all(self): - # for i in range(10): - # self.add_task(id_=f'new{i}') - # return Template(form_header_tmpl + selected_day_tmpl + archived_days_tmpl + form_footer).render(db=self, action=self.prefix+'/all', days=self.days) - - #def show_selected_day(self): - # return Template(form_header_tmpl + selected_day_tmpl + form_footer).render(db=self, action=self.prefix+'/day') - def show_day(self): - current_date = datetime.strptime(self.selected_date, '%Y-%m-%d') + current_date = datetime.strptime(self.selected_date, DATE_FORMAT) prev_date = current_date - timedelta(days=1) - prev_date_str = prev_date.strftime('%Y-%m-%d') + prev_date_str = prev_date.strftime(DATE_FORMAT) next_date = current_date + timedelta(days=1) - next_date_str = next_date.strftime('%Y-%m-%d') - return Template(form_header_tmpl + day_tmpl + form_footer).render(db=self, action=self.prefix+'/day', prev_date=prev_date_str, next_date=next_date_str) + next_date_str = next_date.strftime(DATE_FORMAT) + return Template(form_header_tmpl + tag_filters_tmpl + day_tmpl + form_footer).render(db=self, action=self.prefix+'/day', prev_date=prev_date_str, next_date=next_date_str) def show_calendar(self, start_date_str, end_date_str): days_to_show = {} target_start = start_date_str if start_date_str else sorted(self.days.keys())[0] - target_start = str(datetime.now())[:10] if 'today' == target_start else target_start + # target_start = str(datetime.now())[:10] if 'today' == target_start else target_start target_end = end_date_str if end_date_str else sorted(self.days.keys())[-1] - todays_date = str(datetime.now())[:10] - start_date = datetime.strptime(target_start, '%Y-%m-%d') - end_date = datetime.strptime(target_end, '%Y-%m-%d') + # todays_date = str(datetime.now())[:10] + start_date = datetime.strptime(target_start, DATE_FORMAT) + end_date = datetime.strptime(target_end, DATE_FORMAT) for n in range(int((end_date - start_date).days) + 1): current_date_obj = start_date + timedelta(n) - current_date = current_date_obj.strftime('%Y-%m-%d') + current_date = current_date_obj.strftime(DATE_FORMAT) if current_date not in self.days.keys(): days_to_show[current_date] = self.add_day() else: days_to_show[current_date] = self.days[current_date] - days_to_show[current_date].weekday = datetime.strptime(current_date, '%Y-%m-%d').strftime('%A') + days_to_show[current_date].weekday = datetime.strptime(current_date, DATE_FORMAT).strftime('%A') for task_uuid, todo in days_to_show[current_date].todos.items(): todo.visible = self.tasks[task_uuid].visible - return Template(calendar_tmpl).render(db=self, days=days_to_show) + return Template(form_header_tmpl + calendar_tmpl + form_footer).render(db=self, days=days_to_show, action=self.prefix+'/calendar', today=str(datetime.now())[:10], start_date=start_date_str, end_date=end_date_str) def show_todo(self, task_uuid, selected_date): todo = self.days[selected_date].todos[task_uuid] @@ -471,7 +452,6 @@ class TodoDB(PlomDB): todo = self.days[date].todos[task_uuid] else: todo = self.days[date].add_todo(task_uuid) - # todo = self.days[date].todos[task_uuid] todo.day_weight = float(day_weight) if len(day_weight) > 0 else None todo.done = done todo.comment = comment @@ -487,7 +467,7 @@ class TodoDB(PlomDB): task.tags_joined = tags_joined def show_tasks(self): - return Template(form_header_tmpl + tasks_tmpl + form_footer).render(db=self, action=self.prefix+'/tasks') + return Template(form_header_tmpl + tag_filters_tmpl + tasks_tmpl + form_footer).render(db=self, action=self.prefix+'/tasks') @@ -509,130 +489,65 @@ class TodoHandler(PlomHandler): postvars = parse_qs(self.rfile.read(length).decode(), keep_blank_values=1) parsed_url = urlparse(self.path) db = TodoDB(prefix=prefix) - if parsed_url.path == prefix + '/todo': + + if parsed_url.path == prefix + '/calendar': + start = postvars['start'][0] if len(postvars['start'][0]) > 0 else '' + end = postvars['end'][0] if len(postvars['end'][0]) > 0 else '' + homepage = f'{prefix}/calendar?t_and=calendar&start={start}&end={end}' + + elif parsed_url.path == prefix + '/todo': task_uuid = postvars['task_uuid'][0] date = postvars['date'][0] db.update_todo(task_uuid, date, postvars['day_weight'][0], 'done' in postvars.keys(), postvars['comment'][0]) homepage = f'{prefix}/todo?task={task_uuid}&date={date}' + elif parsed_url.path == prefix + '/task': id_ = postvars['id'][0] db.update_task(id_, postvars['title'][0], postvars['default_weight'][0], postvars['tags'][0]) homepage = f'{prefix}/task?id={id_}' + elif parsed_url.path in {prefix + '/tasks', prefix + '/day'}: - if 't_filter_and' in postvars.keys(): - for target in postvars['t_filter_and']: - db.t_filter_and.add(target) - if 't_filter_not' in postvars.keys(): - for target in postvars['t_filter_not']: - db.t_filter_not.add(target) + for target in postvars['t_and']: + if not target in db.t_filter_and: + db.t_filter_and += [target] + for target in postvars['t_not']: + if not target in db.t_filter_not: + db.t_filter_not += [target] if 'hide_unchosen' in postvars.keys(): db.hide_unchosen = True data = [('t_and', f) for f in db.t_filter_and] + [('t_not', f) for f in db.t_filter_not] + [('hide_unchosen', int(db.hide_unchosen))] + if parsed_url.path == prefix + '/tasks': encoded_params = urlencode(data) homepage = f'{prefix}/tasks?{encoded_params}' + elif parsed_url.path == prefix + '/day': - db.switch_to_day(postvars['original_selected_date'][0]) + db.selected_date = postvars['original_selected_date'][0] new_selected_date = postvars['new_selected_date'][0] try: - datetime.strptime(new_selected_date, '%Y-%m-%d') + datetime.strptime(new_selected_date, DATE_FORMAT) except ValueError: raise PlomException(f"{prefix} bad date string: {new_selected_date}") if new_selected_date != db.selected_date: - if new_selected_date in db.days.keys(): - raise PlomException('cannot use same date twice') - else: - db.days[new_selected_date] = db.selected_day - del db.days[db.selected_date] - db.selected_date = new_selected_date - for i, uuid in enumerate(postvars['t_uuid']): - t = db.tasks[uuid] - if uuid in db.selected_day.todos.keys() and ((not 'choose' in postvars) or uuid not in postvars['choose']): - del db.selected_day.todos[uuid] - if 'choose' in postvars.keys(): + db.change_selected_days_date(new_selected_date) + if 't_uuid' in postvars.keys(): for i, uuid in enumerate(postvars['t_uuid']): - if uuid in postvars['choose']: - done = 'done' in postvars and uuid in postvars['done'] - db.update_todo(uuid, db.selected_date, postvars['day_weight'][i], done, postvars['todo_comment'][i]) - if 'comment' in postvars.keys(): - db.selected_day.comment = postvars['comment'][0] + t = db.tasks[uuid] + if uuid in db.selected_day.todos.keys() and ((not 'choose' in postvars) or uuid not in postvars['choose']): + del db.selected_day.todos[uuid] + if 'choose' in postvars.keys(): + for i, uuid in enumerate(postvars['t_uuid']): + if uuid in postvars['choose']: + done = 'done' in postvars and uuid in postvars['done'] + db.update_todo(uuid, db.selected_date, postvars['day_weight'][i], done, postvars['todo_comment'][i]) + if 'day_comment' in postvars.keys(): + db.selected_day.comment = postvars['day_comment'][0] data += [('date', db.selected_date)] encoded_params = urlencode(data) homepage = f'{prefix}/day?{encoded_params}' + db.write() self.redirect(homepage) - # db = TodoDB(prefix=prefix, selected_date=postvars['original_selected_date'][0]) - # # import pprint - # # pp = pprint.PrettyPrinter(indent=4) - # # pp.pprint(postvars) - # db.t_filter_and = set() - # db.t_filter_not = set() - # if 't_filter_and' in postvars.keys(): - # for target in postvars['t_filter_and']: - # db.t_filter_and.add(target) - # if 't_filter_not' in postvars.keys(): - # for target in postvars['t_filter_not']: - # db.t_filter_not.add(target) - # if 'hide_unchosen' in postvars.keys(): - # db.hide_unchosen = True - # if 't_uuid' in postvars.keys(): - # new_postvars_t_uuid = postvars['t_uuid'].copy() - # for i, uuid in enumerate(postvars['t_uuid']): - # if len(uuid) < 36 and len(postvars['t_title'][i]) > 0: - # new_uuid, t = db.add_task(return_id=True) - # new_postvars_t_uuid[i] = new_uuid - # for key in [k for k in postvars.keys() if not k == 't_uuid']: - # if uuid in postvars[key]: - # uuid_index = postvars[key].index(uuid) - # postvars[key][uuid_index] = new_uuid - # postvars['t_uuid'] = new_postvars_t_uuid - # for i, uuid in enumerate(postvars['t_uuid']): - # if len(uuid) < 36: - # continue - # t = db.tasks[uuid] - # t.set_title(postvars['t_title'][i]) - # t.tags_from_joined_string(postvars['t_tags'][i]) - # t.set_default_weight(float(postvars['t_default_weight'][i])) - # if uuid in db.selected_day.todos.keys() and ((not 'choose' in postvars) or uuid not in postvars['choose']): - # del db.selected_day.todos[uuid] - # if 'choose' in postvars.keys(): - # for i, uuid in enumerate(postvars['t_uuid']): - # if uuid in postvars['choose']: - # done = 'done' in postvars and uuid in postvars['done'] - # day_weight = float(postvars['day_weight'][i]) if postvars['day_weight'][i] else None - # db.selected_day.add_todo(uuid, {'done': done, 'day_weight': day_weight}) - - # if 'comment' in postvars.keys(): - # db.selected_day.comment = postvars['comment'][0] - # if 'new_selected_date' in postvars.keys(): - # new_selected_date = postvars['new_selected_date'][0] - # try: - # datetime.strptime(new_selected_date, '%Y-%m-%d') - # except ValueError: - # raise PlomException(f"{prefix} bad date string: {new_selected_date}") - # if new_selected_date != db.selected_date: - # if new_selected_date in db.days.keys(): - # raise PlomException('cannot use same date twice') - # else: - # db.days[new_selected_date] = db.selected_day - # del db.days[db.selected_date] - # db.selected_date = new_selected_date - - # switch_edited_day = None - # day_edit_prefix = 'edit_' - # for k in postvars.keys(): - # if k.startswith(day_edit_prefix): - # switch_edited_day = k[len(day_edit_prefix):] - # db.switch_to_day(switch_edited_day) - # break - # db.write() - # data = [('t_and', f) for f in db.t_filter_and] + [('t_not', f) for f in db.t_filter_not] + [('hide_unchosen', int(db.hide_unchosen))] + [('date', db.selected_date)] - # encoded_params = urlencode(data) - # if prefix + '/day' == parsed_url.path: - # homepage = f'{prefix}/day?{encoded_params}' - # else: - # homepage = f'{prefix}/all?{encoded_params}' - # self.redirect(homepage) def do_GET(self): self.try_do(self.show_db) @@ -642,8 +557,8 @@ class TodoHandler(PlomHandler): parsed_url = urlparse(self.path) params = parse_qs(parsed_url.query) selected_date = params.get('date', [None])[0] - t_filter_and = set(params.get('t_and', [])) - t_filter_not = set(params.get('t_not', ['deleted'])) + t_filter_and = params.get('t_and', []) + t_filter_not = params.get('t_not', ['deleted']) hide_unchosen_params = params.get('hide_unchosen', []) hide_unchosen = len(hide_unchosen_params) > 0 and hide_unchosen_params[0] != '0' db = TodoDB(prefix, selected_date, t_filter_and, t_filter_not, hide_unchosen) -- 2.30.2