fix rebase
This commit is contained in:
parent
fbf9df1d48
commit
282fe3f0e6
|
@ -12,7 +12,7 @@ from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
from utils.save_snapshots import move_json, save_in_disk
|
from utils.save_snapshots import move_json, save_in_disk
|
||||||
from evidence.parse import Build
|
from evidence.parse import Build
|
||||||
from evidence.models import Annotation
|
from evidence.models import SystemProperty
|
||||||
from lot.models import Lot, LotTag, DeviceLot
|
from lot.models import Lot, LotTag, DeviceLot
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,9 +85,8 @@ def create_custom_id(dhid, uuid, user):
|
||||||
if not uuid or not dhid:
|
if not uuid or not dhid:
|
||||||
return
|
return
|
||||||
|
|
||||||
tag = Annotation.objects.filter(
|
tag = SystemProperty.objects.filter(
|
||||||
uuid=uuid,
|
uuid=uuid,
|
||||||
type=Annotation.Type.SYSTEM,
|
|
||||||
key='CUSTOM_ID',
|
key='CUSTOM_ID',
|
||||||
owner=user.institution
|
owner=user.institution
|
||||||
).first()
|
).first()
|
||||||
|
@ -95,9 +94,8 @@ def create_custom_id(dhid, uuid, user):
|
||||||
if tag or not uuid or not dhid:
|
if tag or not uuid or not dhid:
|
||||||
return
|
return
|
||||||
|
|
||||||
Annotation.objects.create(
|
SystemProperty.objects.create(
|
||||||
uuid=uuid,
|
uuid=uuid,
|
||||||
type=Annotation.Type.SYSTEM,
|
|
||||||
key='CUSTOM_ID',
|
key='CUSTOM_ID',
|
||||||
value=dhid,
|
value=dhid,
|
||||||
owner=user.institution,
|
owner=user.institution,
|
||||||
|
@ -137,7 +135,7 @@ def migrate_snapshots(row, user):
|
||||||
### migration lots ###
|
### migration lots ###
|
||||||
def migrate_lots(row, user):
|
def migrate_lots(row, user):
|
||||||
tag = row.get("type", "Temporal")
|
tag = row.get("type", "Temporal")
|
||||||
name = row.get("name")
|
name = row.get("lot_name")
|
||||||
ltag = LotTag.objects.filter(name=tag, owner=user.institution).first()
|
ltag = LotTag.objects.filter(name=tag, owner=user.institution).first()
|
||||||
if tag and not ltag:
|
if tag and not ltag:
|
||||||
ltag = LotTag.objects.create(
|
ltag = LotTag.objects.create(
|
||||||
|
@ -146,7 +144,7 @@ def migrate_lots(row, user):
|
||||||
user=user
|
user=user
|
||||||
)
|
)
|
||||||
|
|
||||||
if Lot.objects.filter(name=tag, owner=user.institution).first():
|
if Lot.objects.filter(name=name, owner=user.institution).first():
|
||||||
return
|
return
|
||||||
|
|
||||||
Lot.objects.create(
|
Lot.objects.create(
|
||||||
|
@ -164,8 +162,7 @@ def add_device_in_lot(row, user):
|
||||||
if not lot_name or not dhid:
|
if not lot_name or not dhid:
|
||||||
return
|
return
|
||||||
|
|
||||||
dev = Annotation.objects.filter(
|
dev = SystemProperty.objects.filter(
|
||||||
type=Annotation.Type.SYSTEM,
|
|
||||||
key='CUSTOM_ID',
|
key='CUSTOM_ID',
|
||||||
value=dhid,
|
value=dhid,
|
||||||
owner=user.institution,
|
owner=user.institution,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
-- save dhids and uuids of snapshots
|
-- save dhids and uuids of snapshots
|
||||||
copy(
|
copy(
|
||||||
select d.devicehub_id as dhid, sp.uuid from usody.action_with_one_device as one
|
select d.devicehub_id as dhid, sp.uuid as uuid from usody.action_with_one_device as one
|
||||||
join usody.action as ac on ac.id=one.id
|
join usody.action as ac on ac.id=one.id
|
||||||
join usody.device as d on d.id=one.device_id
|
join usody.device as d on d.id=one.device_id
|
||||||
join usody.snapshot as sp on sp.id=one.id
|
join usody.snapshot as sp on sp.id=one.id
|
||||||
|
@ -16,7 +16,7 @@ with (format csv, header, delimiter ';', quote '"');
|
||||||
|
|
||||||
-- save lots and types
|
-- save lots and types
|
||||||
copy(
|
copy(
|
||||||
select distinct l.name, 'Incoming' from usody.transfer as t
|
select distinct l.name as lot_name, 'Incoming' as type from usody.transfer as t
|
||||||
join usody.lot as l on l.id=t.lot_id
|
join usody.lot as l on l.id=t.lot_id
|
||||||
join common.user as u on u.id=l.owner_id
|
join common.user as u on u.id=l.owner_id
|
||||||
where u.email=:'email' and
|
where u.email=:'email' and
|
||||||
|
@ -26,7 +26,7 @@ where u.email=:'email' and
|
||||||
with (format csv, header, delimiter ';', quote '"');
|
with (format csv, header, delimiter ';', quote '"');
|
||||||
|
|
||||||
copy(
|
copy(
|
||||||
select distinct l.name, 'Outgoing' from usody.transfer as t
|
select distinct l.name as lot_name, 'Outgoing' as type from usody.transfer as t
|
||||||
join usody.lot as l on l.id=t.lot_id
|
join usody.lot as l on l.id=t.lot_id
|
||||||
join common.user as u on u.id=l.owner_id
|
join common.user as u on u.id=l.owner_id
|
||||||
where u.email=:'email' and
|
where u.email=:'email' and
|
||||||
|
@ -36,7 +36,7 @@ where u.email=:'email' and
|
||||||
with (format csv, header, delimiter ';', quote '"');
|
with (format csv, header, delimiter ';', quote '"');
|
||||||
|
|
||||||
copy(
|
copy(
|
||||||
select distinct l.name, 'Temporary' from usody.lot as l
|
select distinct l.name as lot_name, 'Temporary' as type from usody.lot as l
|
||||||
left join usody.transfer as t on t.lot_id=l.id
|
left join usody.transfer as t on t.lot_id=l.id
|
||||||
join common.user as u on u.id=l.owner_id
|
join common.user as u on u.id=l.owner_id
|
||||||
where u.email=:'email' and
|
where u.email=:'email' and
|
||||||
|
|
Loading…
Reference in a new issue