Module:MOS tunings: Difference between revisions

Ganaram inukshuk (talk | contribs)
bugfix sorting algorithm
Ganaram inukshuk (talk | contribs)
bugfixing preprocess function
Line 76: Line 76:
-- hardness. If there are zero step ratios, then return "Tunings"
-- hardness. If there are zero step ratios, then return "Tunings"
if #step_ratios > 1 then
if #step_ratios > 1 then
step_ratio_range = (tamnams.lookup_step_ratio_range(step_ratios[1], step_ratios[#step_ratios]) .. " Tunings") or "Tunings"
step_ratio_range = tamnams.lookup_step_ratio_range(step_ratios[1], step_ratios[#step_ratios])
if step_ratio_range ~= nil then
step_ratio_range = p.capitalize_first(step_ratio_range) .. " Tunings"
else
step_ratio_range = "Tunings"
end
elseif #step_ratios == 1 then
elseif #step_ratios == 1 then
step_ratio_range = (tamnams.lookup_step_ratio(step_ratios[1]) or string.format("%s/%s", step_ratios[1][1], step_ratios[1][2])) .. " Tuning"
step_ratio_range = tamnams.lookup_step_ratio(step_ratios[1])
if step_ratio_range ~= nil then
step_ratio_range = p.capitalize_first(step_ratio_range) .. " Tuning"
else
step_ratio_range = string.format("%s/%s", step_ratios[1][1], step_ratios[1][2]) .. " Tuning"
end
else
else
step_ratio_range = "Tunings"
step_ratio_range = "Tunings"
end
end
-- Capitalize first letter
step_ratio_range = p.capitalize_first(step_ratio_range)
return step_ratio_range, step_ratios
return step_ratio_range, step_ratios