Skip to content

Commit

Permalink
Bugfix when borrowing for more than 30 days, fix sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
sondregronas committed Nov 1, 2023
1 parent ecdc983 commit b85fffa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion BookingSystem/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def _update_last_seen(item_id: str) -> None:

def register_out(item_id: str, userid: str, days: str = 1) -> None:
"""Set the item with the given ID to unavailable and register the order details."""
due_date = datetime.now() + timedelta(days=datetime.strptime(days, '%d').day)
due_date = datetime.now() + timedelta(days=int(days))

item = get(item_id)
if item.available == 0:
Expand Down
4 changes: 2 additions & 2 deletions BookingSystem/templates/index_admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ <h4>
<td>{{ item.name }} ({{ item.category }})</td>
<td>{{ item.lender_name }} <small> ({{ item.classroom }}{% if item.teacher %},
{{ item.teacher }}{% endif %})</small></td>
<td>{{ item.order_due_date|strftime }}</td>
<td data-sort="{{ item.order_due_date }}">{{ item.order_due_date|strftime }}</td>
<td>
<a onclick="postpone('{{ item.id }}', '{{ item.lender }}', this.parentNode.parentNode)">Utsett
frist</a>
Expand Down Expand Up @@ -94,7 +94,7 @@ <h4>
type: 'blue',
icon: 'fa fa-calendar-plus-o',
content: `<i>Lånt til ${lender}</i>` +
'<br><br>Utlånsfristen kan utsettes opp til 7 dager, kontaktlærer bør varsles om utsettelsen før den gjennomføres.',
'<br><br>Utlånsfristen kan utsettes opp til 7 dager, kontaktlærer bør varsles om utsettelsen før den gjennomføres.',
buttons: {
oneDay: {
text: '1 dag',
Expand Down
2 changes: 1 addition & 1 deletion BookingSystem/templates/innlevering.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h3>Sjekk at alt er med - bruk søkefeltet under til å dobbeltsjekke alle aktiv
<td>{{ item.name }} ({{ item.category }})</td>
<td>{{ item.lender_name }} <small> ({{ item.classroom }}{% if item.teacher %},
{{ item.teacher }}{% endif %})</small></td>
<td>{{ item.order_due_date|strftime }}</td>
<td data-sort="{{ item.order_due_date }}">{{ item.order_due_date|strftime }}</td>
</tr>
{% endfor %}
</table>
Expand Down

0 comments on commit b85fffa

Please sign in to comment.