mirror of https://github.com/logos-co/open-law.git
fix test
This commit is contained in:
parent
bc93400077
commit
2bda500468
|
@ -79,7 +79,7 @@ class Section(BaseModel):
|
||||||
@property
|
@property
|
||||||
def approved_interpretation(self):
|
def approved_interpretation(self):
|
||||||
interpretation = Interpretation.query.filter_by(
|
interpretation = Interpretation.query.filter_by(
|
||||||
approved=True, section_id=self.id
|
approved=True, section_id=self.id, is_deleted=False
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
if interpretation:
|
if interpretation:
|
||||||
|
@ -91,7 +91,9 @@ class Section(BaseModel):
|
||||||
Interpretation, func.count(Interpretation.votes).label("total_votes")
|
Interpretation, func.count(Interpretation.votes).label("total_votes")
|
||||||
)
|
)
|
||||||
.join(InterpretationVote)
|
.join(InterpretationVote)
|
||||||
.filter(Interpretation.section_id == self.id)
|
.filter(
|
||||||
|
Interpretation.section_id == self.id, Interpretation.is_deleted is False
|
||||||
|
)
|
||||||
.group_by(Interpretation.id)
|
.group_by(Interpretation.id)
|
||||||
.order_by(text("total_votes DESC"))
|
.order_by(text("total_votes DESC"))
|
||||||
).first()
|
).first()
|
||||||
|
@ -100,7 +102,7 @@ class Section(BaseModel):
|
||||||
|
|
||||||
# oldest
|
# oldest
|
||||||
interpretation = (
|
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)
|
.order_by(Interpretation.created_at)
|
||||||
.first()
|
.first()
|
||||||
)
|
)
|
||||||
|
|
|
@ -241,13 +241,16 @@
|
||||||
<!-- prettier-ignore -->
|
<!-- prettier-ignore -->
|
||||||
<a href="{{url_for('book.section_view',book_id=book.id,collection_id=collection.id,sub_collection_id=sub_collection.id)}}">
|
<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>
|
<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="ql-snow truncate md:max-w-xl">
|
||||||
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
|
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
|
||||||
<p>{{ section.approved_interpretation.text|safe }}</p>
|
<p>{{ section.approved_interpretation.text|safe }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
|
<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">
|
<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>
|
<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>
|
</span>
|
||||||
|
@ -275,6 +278,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -283,18 +287,21 @@
|
||||||
{% for section in collection.active_sections %}
|
{% for section in collection.active_sections %}
|
||||||
<a href="{{url_for('book.section_view',book_id=book.id,collection_id=collection.id)}}">
|
<a href="{{url_for('book.section_view',book_id=book.id,collection_id=collection.id)}}">
|
||||||
<p class="truncate">{{ section.label }}</p></a>
|
<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="ql-snow truncate md:max-w-xl">
|
||||||
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
|
<div class="dark:text-white h-30 ql-editor-readonly !px-0">
|
||||||
<p>{{ section.approved_interpretation.text|safe }}</p>
|
<p>{{ section.approved_interpretation.text|safe }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex w-full ml-auto align-center justify-between space-x-3 border-t py-3">
|
<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.user.username}} on {{section.approved_interpretation.created_at.strftime('%B %d, %Y')}}</span>
|
||||||
<span class="space-x-0.5 flex items-center">
|
<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>
|
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Reference in New Issue