Module:Class mask: Difference between revisions

Content deleted Content added
FM-class added to FQS
new logic for b-class checklist parameters, mask will not autodemote or promote unless the whole checklist is completed
Line 17:
-- Should not be used with non-ascii strings.
return s:sub(1, 1):upper() .. s:sub(2, -1)
end
 
local isTruthyBParam = function(s)
s = s and s:lower()
return not s or s == 'yes' or s == 'y' or s == '1' or s == 'pass' or s == 'na' or s == 'n/a' or s == '¬' or s == 'unused'
end
 
Line 61 ⟶ 56:
end
end
 
local getGrade = function(args, title)
local grade = args[1]
Line 76 ⟶ 72:
 
-- B
elseif grade == 'b' or grade == 'c' then
local mask = mw.loadData('Module:WikiProject banner/config').b_checklist.mask
local bParams = {'b1', 'b2', 'b3', 'b4', 'b5', 'b6'}
local isExtended = falseargs.b1 or args.b2 or args.b3 or args.b4 or args.b5 or args.b6
for _, param in ipairs(bParams) do
if args[param] then
isExtended = true
break
end
end
if isExtended then
local isBall_complete, all_pass = true, true
for _,i param= in1, ipairs(bParams)6 do
local b_param = args['b'..i] and mask[string.lower(args['b'..i])]
if not isTruthyBParam(args[param]) then
if b_param and b_param~='y' and b_param~='x' then -- criterion in use and is not passed or marked not applicable
isB = false
breakall_pass = false
if b_param~='n' then
isB all_complete= false
break end
end
end
ret = isBall_pass and 'B' or-- 'C'return B if all criteria are marked passed
or all_complete and 'C' -- or return C if whole checklist is completed but not all passed
elseif args.b ~= 'no' then
or grade:upper() -- otherwise defer to entered grade
ret = 'B'
ifelseif args[paramgrade]~='no' then
ret = 'B'grade:upper()
end
 
-- Upper-case
elseif grade == 'fa' or grade == 'fl' or grade == 'a' or grade == 'ga' or grade == 'c' then
if args[grade] ~= 'no' then
ret = grade:upper()