Merge branch 'testing' into feature/3999-setings

This commit is contained in:
Cayo Puigdefabregas 2022-11-30 16:13:33 +01:00
commit 4fa6f9f343
7 changed files with 35 additions and 11 deletions

View file

@ -7,6 +7,15 @@ ml).
## testing ## testing
## [2.5.0] - 2022-11-30
- [added] #407 erasure section with tabs in top.
- [added] #411 add new generic device as Other.
- [changed] #409 add backend pagination instead of javascript.
- [changed] #410 change teh top search for advanced search.
- [fixed] #412 show in snapshots log, type upload correctly.
- [fixed] #413 put order in documents.
- [fixed] #415 put prefix of lot in result of search.
## [2.4.3] - 2022-11-18 ## [2.4.3] - 2022-11-18
- [added] #386 add registration module. - [added] #386 add registration module.
- [added] #387 add template settings for Secure Erasure. - [added] #387 add template settings for Secure Erasure.

View file

@ -1 +1 @@
__version__ = "2.4.3" __version__ = "2.5.0"

View file

@ -141,6 +141,7 @@ class ErasureListView(DeviceListMixin):
) )
if orphans: if orphans:
schema = app.config.get('SCHEMA') schema = app.config.get('SCHEMA')
_user = g.user.id
sql = f""" sql = f"""
select action.id from {schema}.action as action select action.id from {schema}.action as action
inner join {schema}.erase_basic as erase inner join {schema}.erase_basic as erase
@ -149,11 +150,14 @@ class ErasureListView(DeviceListMixin):
on device.id=action.parent_id on device.id=action.parent_id
inner join {schema}.placeholder as placeholder inner join {schema}.placeholder as placeholder
on placeholder.binding_id=device.id on placeholder.binding_id=device.id
where action.parent_id is null or placeholder.kangaroo=true where (action.parent_id is null or placeholder.kangaroo=true)
and action.author_id='{_user}'
""" """
ids = (e[0] for e in db.session.execute(sql)) ids = (e[0] for e in db.session.execute(sql))
erasure = EraseBasic.query.filter(EraseBasic.id.in_(ids)).order_by( erasure = (
EraseBasic.created.desc() EraseBasic.query.filter(EraseBasic.id.in_(ids))
.filter_by(author=g.user)
.order_by(EraseBasic.created.desc())
) )
self.context['orphans'] = True self.context['orphans'] = True

View file

@ -73,7 +73,7 @@ class SnapshotsLog(Thing):
snapshots = [] snapshots = []
for s in self.snapshot.device.actions: for s in self.snapshot.device.actions:
if s == self.snapshot: if s == self.snapshot:
continue break
if s.type == self.snapshot.type: if s.type == self.snapshot.type:
snapshots.append(s) snapshots.append(s)
return snapshots and 'Update' or 'New Device' return snapshots and 'Update' or 'New Device'

View file

@ -172,7 +172,9 @@ class TradeDocument(Thing):
return sorted(ev for ev in actions if ev.severity >= Severity.Warning) return sorted(ev for ev in actions if ev.severity >= Severity.Warning)
def __lt__(self, other): def __lt__(self, other):
return self.id < other.id if self.id and other.id:
return self.id < other.id
return False
def __str__(self) -> str: def __str__(self) -> str:
return '{0.file_name}'.format(self) return '{0.file_name}'.format(self)

View file

@ -16,7 +16,7 @@
<div class="col-xl-12"> <div class="col-xl-12">
<div class="card"> <div class="card d-none">
<div class="tab-content pt-2"> <div class="tab-content pt-2">
<div class="flex mt-4 mb-4"> <div class="flex mt-4 mb-4">
<form method="get" class="ms-4"> <form method="get" class="ms-4">
@ -307,8 +307,8 @@
</a> </a>
{% if dev.lots | length > 0 %} {% if dev.lots | length > 0 %}
<h6 class="d-inline"> <h6 class="d-inline">
{% for lot in dev.lots %} {% for lot in dev.get_lots_for_template() %}
<span class="badge rounded-pill bg-light text-dark">{{ lot.name }}</span> <span class="badge rounded-pill bg-light text-dark">{{ lot }}</span>
{% endfor %} {% endfor %}
</h6> </h6>
{% endif %} {% endif %}

View file

@ -2470,6 +2470,7 @@ def test_bug_3831_documents(user3: UserClientFlask):
assert 'Delete Lot' in body assert 'Delete Lot' in body
assert 'Incoming Lot' in body assert 'Incoming Lot' in body
lot_id = Lot.query.all()[1].id
uri = f'/inventory/lot/{lot_id}/trade-document/add/' uri = f'/inventory/lot/{lot_id}/trade-document/add/'
body, status = user3.get(uri) body, status = user3.get(uri)
@ -2487,8 +2488,16 @@ def test_bug_3831_documents(user3: UserClientFlask):
} }
uri = f'/inventory/lot/{lot_id}/trade-document/add/' uri = f'/inventory/lot/{lot_id}/trade-document/add/'
# body, status = user3.post(uri, data=data, content_type="multipart/form-data") body, status = user3.post(uri, data=data, content_type="multipart/form-data")
# assert status == '200 OK' assert status == '200 OK'
# Second document
uri = f'/inventory/lot/{lot_id}/trade-document/add/'
file_upload = (BytesIO(b_file), file_name)
data['file'] = file_upload
data['csrf_token'] = generate_csrf()
body, status = user3.post(uri, data=data, content_type="multipart/form-data")
assert status == '200 OK'
@pytest.mark.mvp @pytest.mark.mvp