Module:Class mask/sandbox: Difference between revisions

Content deleted Content added
rewrite logic
all the code for the b-class checklist is not needed now
Line 41:
return ucfirst(grade)
end
elseif grade=='b' or grade=='c' or grade=='fa' or grade=='fl' or grade=='a' or grade=='ga' then -- Upper-case
local mask = mw.loadData('Module:WikiProject banner/config').b_checklist.mask
local isExtended = args.b1 or args.b2 or args.b3 or args.b4 or args.b5 or args.b6
if isExtended then
local some_fail, all_pass = false, true
for i = 1, 6 do
local b_param = args['b'..i] and mask[string.lower(args['b'..i])]
if b_param and b_param~='y' and b_param~='x' then -- criterion in use and is not passed or marked not applicable
all_pass = false
if b_param=='n' then
some_fail = true
end
end
end
return all_pass and 'B' -- return B if all criteria are marked passed
or some_fail and 'C' -- or return C if any of the criteria are marked failed
or grade:upper() -- otherwise defer to entered grade
elseif args[grade]~='no' then
return grade:upper()
end
elseif grade=='fa' or grade=='fl' or grade=='a' or grade=='ga' then -- Upper-case
if args[grade]~='no' then
return grade:upper()