Commit 9d333224 authored by Administrator's avatar Administrator

Do not implicitely assume todos have a protocol

parent 8d5fc85f
......@@ -174,7 +174,7 @@ def index():
]
def _todo_sort_key(todo):
protocol = todo.get_first_protocol()
return protocol.date if protocol.date is not None else datetime.now().date()
return protocol.date if protocol is not None and protocol.date is not None else datetime.now().date()
todos = sorted(todos, key=_todo_sort_key, reverse=True)
todos_table = TodosTable(todos) if todos is not None else None
return render_template("index.html", open_protocols=open_protocols, protocol=protocol, todos=todos)
......
......@@ -319,12 +319,12 @@ class TodosTable(Table):
def row(self, todo):
user = current_user()
protocol = todo.get_first_protocol()
mobile_parts = [Table.link(url_for("show_todo", todo_id=todo.id), todo.get_state())]
if protocol is not None:
mobile_parts.append(Table.link(url_for("show_protocol", protocol_id=protocol.id), todo.protocoltype.short_name))
mobile_parts.append(todo.who)
row = [
Markup("<br>").join([
Table.link(url_for("show_todo", todo_id=todo.id), todo.get_state()),
Table.link(url_for("show_protocol", protocol_id=protocol.id), todo.protocoltype.short_name),
todo.who
]),
Markup("<br>").join(mobile_parts),
Table.link(url_for("show_todo", todo_id=todo.id), todo.get_id()),
todo.get_state(),
Table.link(url_for("show_protocol", protocol_id=protocol.id), protocol.get_identifier())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment