Module:Infobox Recipe: Difference between revisions
Fix raw material quantity not multiplying price
The Gaffer (talk | contribs) No edit summary |
(Fix raw material quantity not multiplying price) |
||
Line 1:
require('strict')
require('Module:Mw.html extension')
local currency = require('Module:Currency')
local hc = require('Module:Param Parse').has_content
Line 100 ⟶ 102:
--Creates a row suitable for the raw materials section of the infobox.
local function createRawMaterialRow(item)
local materialBuyPrice = getBuyPrice(item) * (item.quantity or 1)
rawMaterialCost = rawMaterialCost + materialBuyPrice
return mw.html.create('tr')
Line 270 ⟶ 272:
:done()
:done()
-- Values
:tag('tr')
:tag('td')
:css{ ['border-right'] = 'none' }
:wikitext('[[File:' .. args.output1 .. '.png|30px|link=' .. args.output1 .. ']]' or 'Unknown')
:done()▼
:tag('td')▼
:css{ ['border-left'] = 'none' }▼
:wikitext('[[' .. args.output1 .. ']]' or 'Unknown')▼
:done()▼
:tag('td')
:css{ ['text-align'] = 'right' }▼
:wikitext(args.output1qty or 1)▼
:done()▼
:wikitext(currency_cell(output1TotalValue))▼
:done()
-- Add profit data▼
▲ :css{ ['border-left'] = 'none' }
▲ :wikitext('[[' .. args.output1 .. ']]' or 'Unknown')
▲ :done()
▲ :tag('td')
▲ :css{ ['text-align'] = 'right' }
▲ :wikitext(args.output1qty or 1)
▲ :done()
▲ :wikitext(currency_cell(output1TotalValue))
▲ :done()
▲-- Add profit data
:tag('tr')
:tag('th')
|