Content deleted Content added
add some comments with questions I have |
clean up a var name, use a local in one of the functions |
||
Line 13:
end
local function class_percent(param,
return tostring(round(100 * param /
end
local function percent_remaining(sum,
if
return tostring(round(-100 *
else
return nil
Line 58:
}
-- generally, I think if there were more 'project' orthogonal attributes
-- there would be a case for object-orientation here
Line 85 ⟶ 84:
-- I'm not sure if it's clear in this for loop that I want to get
-- parameters 1 to 8, which I could also do instead as 'for 1,8...'' ]]
-- unfortunately can't do for i, class in ipairs(args) because of
-- parameter 9, which is the total non-project
for i, class in pairs(classes) do
if args[i] then
Line 93 ⟶ 94:
end
local
if project then
-- I think it makes more sense to do this sum here rather than in the
-- project loop above, because I initialized
-- project case
project_classes[2]['category'],
project
)
else
end
Line 112 ⟶ 113:
for i, class in pairs(classes) do
if class['count'] ~= 0 then
local percentage = class_percent(class['count'],
root:newline() -- sprinkled through to make the HTML easier to read
:tag('td')
Line 129 ⟶ 130:
root:newline()
local remaining = percent_remaining(sum_classes,
if remaining then
root:tag('td')
|