Merge pull request #317 from eReuse/bugfix/3613-export-placeholder

Bugfix/3613 export placeholder
This commit is contained in:
cayop 2022-07-20 12:17:34 +02:00 committed by GitHub
commit fa7bb86974
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 14 deletions

View file

@ -7,6 +7,9 @@ ml).
## testing
- [added] #312 Placeholder: new, edit, update. (manually and with excel).
- [fixed] #313 Bump numpy from 1.21.6 to 1.22.0.
- [fixed] #314 bugs create placeholder from lot.
- [fixed] #317 bugs about exports placeholders.
## [2.3.0] - 2022-07-12
- [added] #281 Add selenium test.

View file

@ -65,7 +65,7 @@ class DeviceRow(OrderedDict):
self['Device Hardware ID'] = device.hid
self['Device Type'] = device.t
self['Device Chassis'] = ''
if isinstance(device, d.Computer):
if isinstance(device, d.Computer) and not device.placeholder:
self['Device Chassis'] = device.chassis.name
self['Device Serial Number'] = none2str(device.serial_number)
self['Device Model'] = none2str(device.model)
@ -119,8 +119,6 @@ class DeviceRow(OrderedDict):
self['Data Storage Rate'] = ''
self['Data Storage Range'] = ''
self['Price'] = none2str(device.price)
benchram = get_action(device, 'BenchmarkRamSysbench')
if benchram:
self['Benchmark RamSysbench (points)'] = none2str(benchram.rate)
@ -384,7 +382,6 @@ class StockRow(OrderedDict):
self['Lifecycle state'] = device.last_action_of(*states.Trading.actions()).t
except LookupError:
self['Lifecycle state'] = ''
self['Price'] = none2str(device.price)
self['Processor'] = none2str(device.processor_model)
self['RAM (MB)'] = none2str(device.ram_size)
self['Data Storage Size (MB)'] = none2str(device.data_storage_size)

View file

@ -247,10 +247,17 @@
</a>
</li>
<li>
{% if unassigned_devices %}
<span class="dropdown-item" style="color: #999ea4;">
<i class="bi bi-file-spreadsheet"></i>
Devices Lots Spreadsheet
</span>
{% else %}
<a href="javascript:export_file('devices_lots')" class="dropdown-item">
<i class="bi bi-file-spreadsheet"></i>
Devices Lots Spreadsheet
</a>
{% endif %}
</li>
<li>
<a href="javascript:export_file('certificates')" class="dropdown-item">

View file

@ -1,2 +1,2 @@
Type;Chassis;Serial Number;Model;Manufacturer;Registered in;Physical state;Allocate state;Lifecycle state;Price;Processor;RAM (MB);Data Storage Size (MB)
Desktop;Microtower;d1s;d1ml;d1mr;Mon May 16 19:08:44 2022;;;;;p1ml;0;0
Type;Chassis;Serial Number;Model;Manufacturer;Registered in;Physical state;Allocate state;Lifecycle state;Processor;RAM (MB);Data Storage Size (MB)
Desktop;Microtower;d1s;d1ml;d1mr;Wed Jul 20 11:11:28 2022;;;;p1ml;0;0

1 Type Chassis Serial Number Model Manufacturer Registered in Physical state Allocate state Lifecycle state Price Processor RAM (MB) Data Storage Size (MB)
2 Desktop Microtower d1s d1ml d1mr Mon May 16 19:08:44 2022 Wed Jul 20 11:11:28 2022 p1ml 0 0

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -479,6 +479,7 @@ def test_export_multiple_different_devices(user: UserClient):
query=[('filter', {'type': ['Computer', 'Keyboard', 'Monitor']})],
accept='text/csv',
)
f = StringIO(csv_str)
obj_csv = csv.reader(f, f)
export_csv = list(obj_csv)
@ -491,7 +492,6 @@ def test_export_multiple_different_devices(user: UserClient):
@pytest.mark.mvp
def test_report_devices_stock_control(user: UserClient, user2: UserClient):
# TODO
"""Test export device information in a csv file."""
snapshot, _ = user.post(file('basic.snapshot'), res=Snapshot)
snapshot2, _ = user2.post(file('basic.snapshot2'), res=Snapshot)