Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -553,9 +553,16 @@ def generate_webshop_files (settings, lily_files, tex_files): ...@@ -553,9 +553,16 @@ def generate_webshop_files (settings, lily_files, tex_files):
if i in noscore_instruments: if i in noscore_instruments:
continue; continue;
score_info = score_types.get (i, {}); 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"); 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 }); 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)); webshop_settings["webshop_editions"] = sorted (scores, key=lambda k: k.get("id", 0));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment