Commit 91fc4362 authored by Ryan Herbert's avatar Ryan Herbert

sample_set.py calculate sum of sets better for redirect

after add, calculate the sum of sets since the length_mapping excludes
types which are of equal numbers in the form, yielding unwanted
behaviour when adding only one of each set, or any combination of one
element of available set types.
parent 0b023b4f
Pipeline #19998 failed with stages
in 42 seconds
......@@ -438,9 +438,11 @@ def submit():
set_types = vidjil_utils.get_found_types(data)
length_mapping = {}
sum_sets = 0
for set_type in set_types:
helper = mf.get_instance(set_type)
length = len(data[set_type])
sum_sets += length
if length not in length_mapping:
length_mapping[length] = set_type
for p in data[set_type]:
......@@ -505,7 +507,6 @@ def submit():
register_tags(db, set_type, p["id"], p["info"], group_id, reset=reset)
if not error:
sum_sets = sum(length_mapping.keys())
max_num = max(length_mapping.keys())
msg = "successfully added/edited set(s)"
if sum_sets == 1:
......
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