Module:Task: Difference between revisions

From atwg
No edit summary
No edit summary
Line 36: Line 36:
     
     
    for k2,v2 in pairs ( outputs.results ) do
    for k2,v2 in pairs ( outputs.results ) do
    s = s .. '| [[' .. v2.fulltext .. '|' .. v2.displaytitle .. ']]\n'
    s = s .. '| [[' .. v2.fulltext .. ']]\n'
    -- task stuff
    -- task stuff
    s = s .. '|-\n'
    s = s .. '|-\n'

Revision as of 11:42, 11 February 2018

Documentation for this module may be created at Module:Task/doc

local p = {}
	
function p.displayTable(frame)

	local query = '[[Category:Outcomes]]|?Description|limit=100'
    local outcomes = mw.smw.getQueryResult( query )
    if outcomes == nil or #outcomes.results == 0 then
        return ""
    end
	s = '{| class="wikitable tasktable"\n'
	s = s .. '! Outcome\n'
	s = s .. '! Output\n'
	s = s .. '! Task\n'
	s = s .. '! Type\n'
	s = s .. '! Associated Outputs\n'
	s = s .. '! Primary TeamCollaborating Teams\n'
	s = s .. '! Start Year\n'
	s = s .. '! Duration\n'
	s = s .. '! Depends On Tasks\n'
	s = s .. '! Risks\n'
	s = s .. '! Contingencies\n'
	s = s .. '! Benefits\n'
	s = s .. '! Assumptions\n'
	s = s .. '! Implications\n'
	s = s .. '! Notes\n'
	s = s .. '|-\n'
	
	for k1,v1 in pairs( outcomes.results ) do
		query = '[[Category:Outputs]][[Parent Outcome::' .. v1.fulltext .. ']]|limit=100'
    	local outputs = mw.smw.getQueryResult( query )
    	if outputs == nil or #outputs.results == 0 then
        	return ""
	    end
	    
	    s = s .. '| rowspan="' .. #outputs.results .. '" | [[' .. v1.fulltext .. ']]\n'
	    
	    for k2,v2 in pairs ( outputs.results ) do
	    	s = s .. '| [[' .. v2.fulltext .. ']]\n'
	    	-- task stuff
	    	s = s .. '|-\n'
	    end
    end
    

--[[]
	result = result .. '! rowspan="2" | Issue\n'
		result = result .. '! colspan=' .. #v.values .. ' | ' .. v.name .. '\n'
	end
	result = result .. '|-\n'
	for k1,v1 in ipairs( p.Taxonomy ) do
		for k2,v2 in ipairs( v1.values ) do
			result = result .. '! ' ..
				frame:expandTemplate{ title = 'Tag Link', args = { v2 } } .. '\n'
		end
	end

	result = result .. '|-\n!<br/>'
	for k1,v1 in ipairs( p.Taxonomy ) do
		for k2,v2 in ipairs( v1.values ) do
			result = result .. '!!'
		end
	end
	result = result .. '\n'

	for k1,v1 in pairs( issues.results ) do
		result = result .. '|-\n'
		]]
--		result = result .. '| [[' .. v1.fulltext .. '|' .. v1.printouts['Description'][1] .. ']]\n'
--[[]
		for k2,v2 in ipairs( p.Taxonomy ) do
			local query_values = v1.printouts[v2.property]
			for k3,v3 in ipairs( v2.values ) do
				result = result .. '| style="text-align:center;min-width:60px;" |'
				for k4,v4 in pairs(query_values) do
					if v3 == v4 then
						result = result .. 'X'
					end
				end
				result = result .. '\n'
			end
		end
	end

]]
	s = s .. '|}'
    return s
end

return p