Commit c3d5ac53 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Also handle instrument names like 1a (and sort them correctly) in the webshop definition generation

parent a797323e
......@@ -553,9 +553,16 @@ def generate_webshop_files (settings, lily_files, tex_files):
if i in noscore_instruments:
continue;
score_info = score_types.get (i, {});
score_type = score_info.get ("Name", "");
score_type = score_info.get ("Name", i);
score_id = score_info.get ("Number", "XXX");
sid = int(score_id);
try:
# Replace '1a' to 1.01 (i.e. appended letters will indicate decimals, so they are sorted after 1)
def chartoindex(matchobj):
return "%s.%02d" % (matchobj.group(1), ord(matchobj.group(2).lower())-96);
sid = re.sub(r'^([0-9]+)([a-zA-Z])$', chartoindex, score_id);
sid = float(sid);
except ValueError as e:
sid = score_id;
scores.append({"id": sid, "sku": score_settings.get ("scorenumber")+"-"+score_id, "type": score_type });
webshop_settings["webshop_editions"] = sorted (scores, key=lambda k: k.get("id", 0));
......
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