[Resolved] Full calendar, without leap day June 11, 2017 09:25AM |
Admin Registered: 8 years ago Posts: 800 |
Re: Full calendar, without leap day June 11, 2017 11:09AM |
Moderator Registered: 8 years ago Posts: 21,475 |
Re: Full calendar, without leap day June 13, 2017 12:30PM |
Admin Registered: 8 years ago Posts: 800 |
Re: Full calendar, without leap day June 13, 2017 12:39PM |
Moderator Registered: 8 years ago Posts: 60 |
Re: Full calendar, without leap day June 13, 2017 12:54PM |
Admin Registered: 8 years ago Posts: 800 |
--- 154.lua 2017-06-13 12:08:16.825498098 +0200 +++ 154-ganja1447.lua 2017-06-13 12:23:53.162355800 +0200 @@ -70,10 +70,11 @@ conf.needed = ToNumber(conf.needed) end - if conf.leapday == "allow" then - conf.leapday = "false" - else - conf.leapday = "true" + -- allow = allow skipping leap day + -- ignore = don't count leap day at all + -- default = treat leap day as a normal day + if conf.leapday ~= "allow" and conf.leapday ~= "ignore" then + conf.leapday = "default" end if conf.placed == nil then @@ -134,8 +135,10 @@ local statustable = { } slog = numdone .. " dates of " .. conf.needed .. " completed. " - if conf.leapday == "false" then + if conf.leapday == "allow" then slog = slog .. "This challenge allows leap day to be skipped. " + elseif conf.leapday == "ignore" then + slog = slog .. "This challenge ignores leap day. " end -- Show what is done and what is missing. @@ -169,7 +172,9 @@ local diff = status[key] or 0 diff = conf.limit - diff if ok == false then - if month == 2 and day == 29 and conf.leapday == "false" then + if month == 2 and day == 29 and conf.leapday == "ignore" then + TableInsert(statustable, '<td>X</td>') + elseif month == 2 and day == 29 and conf.leapday == "allow" then TableInsert(statustable, '<td><span style="color:red">(' .. diff .. ")</span></td>") else @@ -177,7 +182,11 @@ .. diff .. "</span></td>") end else - TableInsert(statustable, '<td></td>') + if month == 2 and day == 29 and conf.leapday == "ignore" then + TableInsert(statustable, '<td>X</td>') + else + TableInsert(statustable, '<td></td>') + end end TableInsert(missing, key) else @@ -275,6 +284,10 @@ end end + if conf.leapday == "ignore" and day == "02-29" then + day = "13-01" -- Dummy date that will be ignored later. + end + -- Keep track of number of types logged per day. -- Note: This does not consider ExcludedTypes. if notypes[day] == nil then @@ -335,7 +348,7 @@ local ok = false if numdone >= conf.needed or (numdone == conf.needed - 1 - and conf.leapday == "false" + and conf.leapday == "allow" and (status[makekey(2,29)] == nil or (status[makekey(2,29)] ~= nil and status[makekey(2,29)] < conf.limit)) ) then