Modul:Goalscorers: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
Tidak ada ringkasan suntingan
perbaikan averageString dan updateString untuk bagian templat
 
(11 revisi perantara oleh 2 pengguna tidak ditampilkan)
Baris 1:
require('Module:No globalsstrict');
local yesno = require('Module:Yesno')
 
Baris 90:
function p.addIntroductorySentence() -- menambahkan teks/paragraf awal
local totalGoalString = "Sebanyak" .. g.totalGoals .. " telah dicetak."
local matches, dateUpdated = p.getNumberMatches()
Baris 97:
local Date = require('Module:Date')._Date
local text1 = ""
local text = string.format("Sebanyak %s gol telah dicetak", mw.getLanguage('id'):formatNum(g.totalGoals))
if g.totalGoals >= 1 then
if dateUpdated ~= 'complete' or dateUpdated ~= 'completed' or dateUpdated ~= 'selesai' then text1 = "telah dicetak" end
else
if dateUpdated == 'complete' or dateUpdated == 'completed' or dateUpdated == 'selesai' then text1 = "dicetak" end
end
local text = string.format("Sebanyak %s gol telah dicetak%s", mw.getLanguage('id'):formatNum(g.totalGoals), text1)
if matches then
Baris 103 ⟶ 110:
local precision = 3 -- presisi dua angka dibelakang koma
if average < 1 then precision = 2 end -- presisi satu angka dibelakang koma
average = string.format("%."..precision.."g", average)
averagetext = text .. string.format(" pada %d pertandingan, dengan rata-rata %."..precision.."gs gol per pertandingan", matches, mw.getLanguage('id'):formatNum( tonumber(average)))
text = text .. string.format(" pada %d pertandingan, %s", matches, average)
end
if dateUpdated == 'complete' or dateUpdated =='completed' or dateUpdated =='selesai' or dateUpdated == "" then
text = text .. "."
else
Baris 148 ⟶ 154:
--local round = g.args['round'] or "all" -- round = all(empty)|group|playoffs
--local group = g.args['group'] or "all" -- group = all(empty), A,B,C etc
local round, group = p.getRoundAndGroup()
local allGroupGames = 0
Baris 160 ⟶ 167:
end
if group and (round == "all" and group ~= "all") then -- for totals of all rounds with only one group
allGroupGames = data.updated.group[group][1] -- number matches
latestGroupDate = data.updated.group[group][2] -- update date or completed
end
 
if round == "all" then -- all rounds and goals
matches=0
Baris 730 ⟶ 736:
end
end -- reached end of list of goalscorers
-- if all scorers on one goal, tableString isn't updated in loop above (may need to generalise for other goal number)
if g.args['goals'] goalNumber == 1 then
local rowSpan = rankCount + 1
tableString = tableString .. '\n|-\n| style="text-align:center;" rowspan="' .. rowSpan .. '"|' .. rank
tableString = tableString .. firstplayerCell
tableString = tableString .. '\n| style="text-align:center;" rowspan="' .. rowSpan .. '"|' .. goalNumber
tableString = tableString .. playerCells
end
 
if tableString ~= "" then
Baris 735 ⟶ 750:
return tableString
else
return ("No goalsTidak matchingada requestedgol criteriayang sesuai dengan kriteria yang diminta.")
end
Baris 808 ⟶ 823:
return outputString
else
return ("No goalsTidak matchingada requestedgol criteriayang sesuai dengan kriteria yang diminta.")
end
end
Baris 847 ⟶ 862:
end
if g.args['bold'] and g.args['bold']~='no' then
text = text .. " Pemain bercetakdengan '''cetak tebal''' masih bermain pada turnamen ini."
end
if g.args['further'] then
Baris 885 ⟶ 900:
{{#ifexpr:{{{matches}}}=1|pertandingan|pertandingan}}, dengan rata-rata
{{formatnum: {{#expr:{{{goals}}}/{{{matches}}} round 2}}}} {{formatnum:{{#ifexpr:({{{goals}}}/{{{matches}}} round 2)=1|gol|gol}}}} per pertandingan.}}
{{#if:{{{bold|}}}|{{#if:{{{assists|}}}||&nbsp;}}Pemain bercetakdengan '''cetak tebal''' masih bermain pada turnamen ini.|}}
{{#if:{{{further|}}}|{{#if:{{{assists|}}}||&nbsp;}}{{{further}}}|}}
{{#if:{{{extra|}}}|{{{extra}}}{{clear}}|}}
--]]
local statNumber = gmw.args[getLanguage('goalsid']):formatNum( ortonumber( g.args['assistsgoals'] or 0) ) --format number as string
local matches = g.args['matches']
local statType = "gol"
if g.args['assists'] or g.args['umpan gol'] then statType = "umpan gol" end
if g.args['clean sheets'] or g.args['nirbobol'] then statType = "nirbobol" end
local ongoing = g.args['ongoing']
local text1 = "Sebanyak"
if g.args['lc'] then text1 = "theresebanyak" end
local text2 = ""
if ongoing then text2 = "telah" end
local updateString = ""
local averageString = ""
-- auto version: string.format(" pada %d pertandingan, dengan rata-rata %.3g gol per pertandingan")
if g.args['goals'] and g.args['matches'] then
local averageGoals = g.args['goals']/g.args['matches']
averageString = string.format(" pada %d pertandingan, dengan rata-rata %.3g gol per pertandingan", g.args['matches'], averageGoals)
end
if g.args['updated'] and g.args['updated'] ~= "complete" and g.args['updated'] ~= "completed" and g.args['updated'] ~= "selesai" then
updateString = "&nbsp;(per " ..g.args['updated'].. ")"
end
local titiksep = "."
if g.args['sep'] then sep = g.args['sep'] end
local text = ""
if g.args['goals'] then --Sebanyak %statNumber %statType telah dicetak pada %matches pertandingan, dengan rata-rata %averageString per pertandingan (%updateString)
if g.args['goals'] then
text = string.format("%s %ds %s %s dicetak pada %d pertandingan, dengan rata-rata %s gol per pertandingan"..updateString..sep,
text1, text2, statNumber, statType, averageStringg.args['matches'], mw.updateString..titikgetLanguage('id'):formatNum( tonumber(averageString)))
end
text = p.addAdditionHeaderText(text) -- handles template parameters bold, further, extra
Baris 946 ⟶ 965:
if statType == "gol" or statType == "gol bunuh diri" then
if g.args['goals'] and totalGoals ~= tonumber(g.args['goals']) then
mw.addWarning("PERINGATAN. MismatchJumlah betweengol numberpada of goals listedterdaftar (" .. totalGoals .. ") and goalsdan parameter gol (" .. g.args['goals'] .. ") tidak cocok.")
end
end