Skip to content

Commit

Permalink
public ui: improve displayed information
Browse files Browse the repository at this point in the history
- Removes the due date time in the public interface, when an item is "on
  loan".
  Closes rero#1398.
- Removes the birth date should from the patron profile of the public
  interface.
  Closes rero#1386.
- Replaces the patron barcode label to patron number in the patron
  account (public interface).
  Closes rero#1385.

Co-Authored-by: Renaud Michotte <renaud.michotte@gmail.com>
  • Loading branch information
zannkukai committed Nov 9, 2020
1 parent 363e1ce commit e9772dd
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 14 deletions.
3 changes: 2 additions & 1 deletion rero_ils/modules/items/api/circulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,14 +1230,15 @@ def available(self):
"""Get availability for item."""
return self.item_has_active_loan_or_request() == 0

def get_item_end_date(self, format='short'):
def get_item_end_date(self, format='short', time_format='medium'):
"""Get item due date for a given item."""
loan = get_loan_for_item(item_pid_to_object(self.pid))
if loan:
end_date = loan['end_date']
due_date = format_date_filter(
end_date,
date_format=format,
time_format=time_format,
locale=current_i18n.locale.language,
)
return due_date
Expand Down
2 changes: 1 addition & 1 deletion rero_ils/modules/items/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def item_availability_text(item):
else:
text = ''
if item.status == ItemStatus.ON_LOAN:
due_date = item.get_item_end_date(format='short')
due_date = item.get_item_end_date(format='short', time_format=None)
text = '{msg} {date}'.format(
msg=_('due until'),
date=due_date)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@
<div class="rero-ils-person-icon col-sm-2 col-lg-1">
<i class="fa fa-user fa-5x"></i>
</div>
<hgroup class="col-sm-10 col-lg-11 align-self-end">
<hgroup class="col-sm-10 col-lg-11 align-self-center">
<h1 class="mb-0">{{ record.first_name }} {{ record.last_name }}</h1>
{% if record.birth_date %}
<p>
<b>{{ _('Date of birth') }}:</b> {{ record.birth_date | format_date(
date_format='medium',
time_format=None,
locale=current_i18n.locale.language
)}}
</p>
{% endif %}
</hgroup>
</header>
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ <h4 class="text-secondary border-bottom mt-3 pb-1">{{ _('Personal details') }}</
<dt class="col-lg-3">{{_('Email')}}:</dt>
<dd class="col-lg-9 mb-0">{{ record.email }}</dd>
{% endif %}
<dt class="col-lg-3">{{_('Barcode')}}:</dt>
<dt class="col-lg-3">{{_('Patron number')}}:</dt>
<dd class="col-lg-9 mb-0">{{ record.patron.barcode }}</dd>
<dt class="col-lg-3">{{_('Account expiration')}}:</dt>
<dd class="col-lg-9 mb-0">{{ record.patron.expiration_date | format_date(
Expand Down
2 changes: 1 addition & 1 deletion tests/api/test_availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class locale:
'rero_ils.modules.items.api.circulation.current_i18n',
current_i18n
):
end_date = item.get_item_end_date()
end_date = item.get_item_end_date(time_format=None)
assert item_availability_text(item) == 'due until ' + end_date

"""
Expand Down

0 comments on commit e9772dd

Please sign in to comment.