Commit a36b35e4 authored by André Anjos's avatar André Anjos 💬
Browse files

Fix model-file association

parent aac5ab5e
...@@ -117,6 +117,7 @@ def add_protocols(session, verbose): ...@@ -117,6 +117,7 @@ def add_protocols(session, verbose):
protocol_dir = pkg_resources.resource_filename(__name__, os.path.join('data', protocol_dir = pkg_resources.resource_filename(__name__, os.path.join('data',
'protocols')) 'protocols'))
for name in os.listdir(protocol_dir): for name in os.listdir(protocol_dir):
protocol = Protocol(name) protocol = Protocol(name)
session.add(protocol) session.add(protocol)
...@@ -138,7 +139,8 @@ def add_protocols(session, verbose): ...@@ -138,7 +139,8 @@ def add_protocols(session, verbose):
for row in f: for row in f:
filename, model_ref = row.split() filename, model_ref = row.split()
file_ = retrieve_file(session, filename.decode()) file_ = retrieve_file(session, filename.decode())
model = session.query(Model).filter(Model.name==model_ref.decode()) model = session.query(Model).filter(Model.name==model_ref.decode(),
Model.protocol==protocol)
if model.count() == 0: if model.count() == 0:
model = Model(model_ref.decode(), 'dev', file_.finger, protocol) model = Model(model_ref.decode(), 'dev', file_.finger, protocol)
if verbose: if verbose:
......
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