server: fix update distributor
This commit is contained in:
parent
8ff136ad82
commit
c7f0c49b15
|
@ -321,7 +321,7 @@ post '/part' do
|
|||
part[field].each do |distributor,sku|
|
||||
next unless sku and !sku.empty?
|
||||
statement = @db.prepare("SELECT id FROM distributor WHERE LOWER(name) = ?")
|
||||
ref = statement.execute(name.downcase).to_a[0]
|
||||
ref = statement.execute(distributor.downcase).to_a[0]
|
||||
halt(401, "distributor unknown") unless ref
|
||||
insert = @db.prepare("INSERT INTO distribution (distributor,part,sku) VALUES (?,?,?)");
|
||||
insert.execute(ref["id"], part["id"], sku)
|
||||
|
|
Loading…
Reference in New Issue