mirror of
https://github.com/logos-co/open-law.git
synced 2025-02-10 13:57:17 +00:00
fix test
This commit is contained in:
parent
bc93400077
commit
2bda500468
@ -79,7 +79,7 @@ class Section(BaseModel):
|
||||
@property
|
||||
def approved_interpretation(self):
|
||||
interpretation = Interpretation.query.filter_by(
|
||||
approved=True, section_id=self.id
|
||||
approved=True, section_id=self.id, is_deleted=False
|
||||
).first()
|
||||
|
||||
if interpretation:
|
||||
@ -91,7 +91,9 @@ class Section(BaseModel):
|
||||
Interpretation, func.count(Interpretation.votes).label("total_votes")
|
||||
)
|
||||
.join(InterpretationVote)
|
||||
.filter(Interpretation.section_id == self.id)
|
||||
.filter(
|
||||
Interpretation.section_id == self.id, Interpretation.is_deleted is False
|
||||
)
|
||||
.group_by(Interpretation.id)
|
||||
.order_by(text("total_votes DESC"))
|
||||
).first()
|
||||
@ -100,7 +102,7 @@ class Section(BaseModel):
|
||||
|
||||
# oldest
|
||||
interpretation = (
|
||||
Interpretation.query.filter_by(section_id=self.id)
|
||||
Interpretation.query.filter_by(section_id=self.id, is_deleted=False)
|
||||
.order_by(Interpretation.created_at)
|
||||
.first()
|
||||
)
|
||||
|
@ -241,13 +241,16 @@
|
||||
<!-- prettier-ignore -->
|
||||
<a href="{{url_for('book.section_view',book_id=book.id,collection_id=collection.id,sub_collection_id=sub_collection.id)}}">
|
||||
<p class="truncate">{{ section.label }}</p></a>
|
||||
{% if not section.active_interpretations %}
|
||||
<p>This section is empty</p>
|
||||
{% else %}
|
||||
<div class="ql-snow truncate md:max-w-xl">
|
||||
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
|
||||
<p>{{ section.approved_interpretation.text|safe }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
|
||||
<span class="text-sm">Interpretation by {{section.approved_interpretation.user.username}} on {{section.approved_interpretation.created_at.strftime('%B %d, %Y')}}</span>
|
||||
<span class="text-sm">Interpretation by {{section.approved_interpretation}} on {{section.approved_interpretation.created_at.strftime('%B %d, %Y')}}</span>
|
||||
<span class="space-x-0.5 flex items-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15" /> </svg>
|
||||
</span>
|
||||
@ -275,6 +278,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
@ -283,18 +287,21 @@
|
||||
{% for section in collection.active_sections %}
|
||||
<a href="{{url_for('book.section_view',book_id=book.id,collection_id=collection.id)}}">
|
||||
<p class="truncate">{{ section.label }}</p></a>
|
||||
{% if not section.active_interpretations %}
|
||||
<p>This section is empty</p>
|
||||
{% else %}
|
||||
<div class="ql-snow truncate md:max-w-xl">
|
||||
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
|
||||
<p>{{ section.approved_interpretation.text|safe }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
|
||||
<span class="text-sm">Interpretation by {{section.approved_interpretation.user.username}} on {{section.approved_interpretation.created_at.strftime('%B %d, %Y')}}</span>
|
||||
<span class="space-x-0.5 flex items-center">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6"> <path stroke-linecap="round" stroke-linejoin="round" d="M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15" /> </svg>
|
||||
</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
Loading…
x
Reference in New Issue
Block a user