Commit abc5c119 authored by Administrator's avatar Administrator
Browse files

Fix existance-check of documents on index

parent 2133d2cf
...@@ -281,10 +281,11 @@ class Protocol(DatabaseModel): ...@@ -281,10 +281,11 @@ class Protocol(DatabaseModel):
if not todo.is_done() if not todo.is_done()
] ]
def has_compiled_document(self): def has_compiled_document(self, private=None):
candidates = [ candidates = [
document for document in self.documents document for document in self.documents
if document.is_compiled if document.is_compiled
and (private is None or document.is_private == private)
] ]
return len(candidates) > 0 return len(candidates) > 0
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
{% if protocol.protocoltype.has_modify_right(current_user()) %} {% if protocol.protocoltype.has_modify_right(current_user()) %}
<a class="btn btn-default" href="{{url_for("update_protocol", protocol_id=protocol.id)}}">Protokoll editieren</a> <a class="btn btn-default" href="{{url_for("update_protocol", protocol_id=protocol.id)}}">Protokoll editieren</a>
{% endif %} {% endif %}
{% if protocol.has_compiled_document() %} {% if protocol.has_compiled_document(private=show_private) %}
<a class="btn btn-success" href="{{url_for("download_document", document_id=protocol.get_compiled_document(private=show_private).id)}}">Download</a> <a class="btn btn-success" href="{{url_for("download_document", document_id=protocol.get_compiled_document(private=show_private).id)}}">Download</a>
{% endif %} {% endif %}
</div> </div>
......
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