Content deleted Content added
Testing year_to range coloring. |
Update compressyear to follow highest range when year_to is in use. |
||
Line 107:
end
local function row(builder, args, year, emptyyear, lastyear, highrange)
local oldrange = nil
Line 113:
local itemNum, itemList, range = items(args, year, oldrange)
-- Now check for a new high range and catch it. We need to know what highrange was prior to update though.
-- If compressempty is set, check for empty items, track empty years, and▼
local oldhighrange = nil
if(range > 0 and (highrange == nil or range > highrange)) then
oldhighrange = (highrange or range)
highrange = range
end
oldhighrange = (oldhighrange or highrange)
▲ -- If compressempty is set, check for empty items, track empty years and high ranges, and
-- put out a compressed range when next year is found.
if args.compressempty and oldrange == nil then
-- If we're compressing and there's no items, return this year for tracking.
if #itemList < 1 then
return year, highrange
end
-- If we have an empty year, check it against the last highrange.
if(emptyyear and oldhighrange) then
-- If emptyyear is below or equal the highrange, we need to make adjustments.
if(emptyyear <= oldhighrange) then
-- If the current year is highrange or highrange +1, suppress empty row output entirely.
if(year <= (oldhighrange+1)) then
emptyyear = nil
end
-- If the current year is highrange+2 or more, adjust the emptyyear to be above highrange)
else if(year > (oldhighrange+1)) then
emptyyear = oldhighrange+1
end
end
end
-- If we have items but are tracking an empty year, output compressed range row.
if emptyyear ~= nil then
Line 150 ⟶ 173:
until range == 0
return nil, highrange
end
Line 194 ⟶ 217:
local emptyyear = nil
local highrange = nil
for year = firstyear, lastyear do
local yearcheck, newhighrange = row(ret, args, year, emptyyear, lastyear, highrange)
if (emptyyear == nil and yearcheck ~= nil) or (emptyyear ~= nil and yearcheck == nil) then
emptyyear = yearcheck
end
highrange = newhighrange
end
|