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
## [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
- [added] #386 add registration module.
- [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:
schema = app.config.get('SCHEMA')
_user = g.user.id
sql = f"""
select action.id from {schema}.action as action
inner join {schema}.erase_basic as erase
@ -149,11 +150,14 @@ class ErasureListView(DeviceListMixin):
on device.id=action.parent_id
inner join {schema}.placeholder as placeholder
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))
erasure = EraseBasic.query.filter(EraseBasic.id.in_(ids)).order_by(
EraseBasic.created.desc()
erasure = (
EraseBasic.query.filter(EraseBasic.id.in_(ids))
.filter_by(author=g.user)
.order_by(EraseBasic.created.desc())
)
self.context['orphans'] = True

View File

@ -73,7 +73,7 @@ class SnapshotsLog(Thing):
snapshots = []
for s in self.snapshot.device.actions:
if s == self.snapshot:
continue
break
if s.type == self.snapshot.type:
snapshots.append(s)
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)
def __lt__(self, other):
if self.id and other.id:
return self.id < other.id
return False
def __str__(self) -> str:
return '{0.file_name}'.format(self)

View File

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

View File

@ -2470,6 +2470,7 @@ def test_bug_3831_documents(user3: UserClientFlask):
assert 'Delete Lot' in body
assert 'Incoming Lot' in body
lot_id = Lot.query.all()[1].id
uri = f'/inventory/lot/{lot_id}/trade-document/add/'
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/'
# body, status = user3.post(uri, data=data, content_type="multipart/form-data")
# assert status == '200 OK'
body, status = user3.post(uri, data=data, content_type="multipart/form-data")
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