Commit 6d8f140e authored by Morten Brekkevold's avatar Morten Brekkevold
Browse files

Ignore Kind devices with missing required data.

parent 8013664d
......@@ -162,7 +162,9 @@ def get_kind_data():
def find_kind_duplicates(kind_data):
dupes = find_duplicates([utstyr['navn'] for utstyr in kind_data])
dupes = find_duplicates([
utstyr['navn'] for utstyr in kind_data if utstyr['navn']
if dupes:
LOG.warning("Duplikate utstyrsnavn fra Kind: %s", dupes)
return dupes
......@@ -216,7 +218,12 @@ def should_silently_ignore(kind_json_record):
Silently ignore Kind records that appear to be automatically generated
or otherwise in error
result = '' in kind_json_record.get('opprettet_av', '')
has_no_name = not kind_json_record.get('navn')
is_generated = (
kind_json_record.get('opprettet_av', '')
and '' in kind_json_record.get('opprettet_av', '')
result = has_no_name or is_generated
if result:
LOG.debug("Ignorerer stille %s (%s)",
kind_json_record.get('navn'), kind_json_record.get('id'))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment