mirror of https://github.com/logos-co/open-law.git
mobile: my library shows less books than desktop #212
This commit is contained in:
parent
0c5e168730
commit
abd14bf501
|
@ -9,7 +9,7 @@
|
|||
</a>
|
||||
{% endif %}
|
||||
<a class="flex font-bold text-base" href="{{url_for('book.collection_view',book_id=book.id)}}">
|
||||
{% if not hide_contributing_label and book.user_id != current_user.id %}
|
||||
{% if not hide_contributing_label and book.user_id != current_user.id and current_user in book.contributors_users %}
|
||||
<span class="mr-2 bg-blue-400 dark:!text-black font-normal rounded text-center px-1">Contributing</span>
|
||||
{% endif %}
|
||||
<span class="truncate overflow-x-scroll">
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
<div id="myTabContent">
|
||||
<!-- prettier-ignore -->
|
||||
<div class="hidden p-4 rounded-lg bg-gray-50 dark:bg-gray-800" id="library" role="tabpanel" aria-labelledby="library-tab">
|
||||
{% for book in user.books if not book.is_deleted %}
|
||||
{% for book in books %}
|
||||
{% include 'book/components/book_list_item.html' %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
|
@ -71,11 +71,25 @@ def profile(user_id: int):
|
|||
interpretations: m.Interpretation = m.Interpretation.query.filter_by(
|
||||
user_id=user_id
|
||||
)
|
||||
books: m.Interpretation = (
|
||||
db.session.query(
|
||||
m.Book,
|
||||
)
|
||||
.join(m.BookContributor, m.BookContributor.book_id == m.Book.id, full=True)
|
||||
.filter(
|
||||
or_(
|
||||
m.Book.user_id == user_id,
|
||||
m.BookContributor.user_id == user_id,
|
||||
),
|
||||
m.Book.is_deleted == False, # noqa: E712
|
||||
)
|
||||
).all()
|
||||
|
||||
if not user:
|
||||
log(log.ERROR, "Not found user by id : [%s]", user_id)
|
||||
flash("Cannot find user data", "danger")
|
||||
return render_template(
|
||||
"user/profile.html", user=user, interpretations=interpretations
|
||||
"user/profile.html", user=user, interpretations=interpretations, books=books
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue