-
Notifications
You must be signed in to change notification settings - Fork 103
taking over #7192 for cs wiki vrs-related functionality #7279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
406707d
fddf6c8
d4a1cfb
342b2ab
4c313ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ local _tbd_index = 0 | |
|
|
||
| local PRIZE_TYPE_BASE_CURRENCY = 'BASE_CURRENCY' | ||
| local PRIZE_TYPE_POINTS = 'POINTS' | ||
| local PRIZE_TYPE_PLAYER_SHARE = 'PLAYER_SHARE' | ||
|
|
||
| --- An AwardPlacement is a set of opponents who all share the same award in the tournament. | ||
| --- Its input is generally a table created by `Template:Slot`. | ||
|
|
@@ -75,10 +76,12 @@ function AwardPlacement:_getLpdbData(...) | |
| local prizeMoney = tonumber(self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_BASE_CURRENCY .. 1)) or 0 | ||
| local pointsReward = self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_POINTS .. 1) | ||
| local pointsReward2 = self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_POINTS .. 2) | ||
| local playerShare = tonumber(self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_PLAYER_SHARE .. 1)) | ||
| local lpdbData = { | ||
| date = opponent.date, | ||
| prizemoney = prizeMoney, | ||
| individualprizemoney = Opponent.typeIsParty(opponentType) and (prizeMoney / Opponent.partySize(opponentType)) or 0, | ||
| individualprizemoney = Opponent.typeIsParty(opponentType) and ((playerShare or prizeMoney) / Opponent.partySize(opponentType)) or 0, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need playershare for non teams? |
||
| playerShare = not Opponent.typeIsParty(opponentType) and playerShare or nil, | ||
| mode = 'award_individual', | ||
| weight = 0, | ||
| extradata = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,7 @@ local DASH = '-' | |||||
| local PRIZE_TYPE_BASE_CURRENCY = 'BASE_CURRENCY' | ||||||
| local PRIZE_TYPE_POINTS = 'POINTS' | ||||||
| local PRIZE_TYPE_QUALIFIES = 'QUALIFIES' | ||||||
| local PRIZE_TYPE_PLAYER_SHARE = 'PLAYER_SHARE' | ||||||
|
|
||||||
| -- Allowed none-numeric score values. | ||||||
| local SPECIAL_SCORES = {'W', 'FF' , 'L', 'DQ', 'D'} | ||||||
|
|
@@ -235,6 +236,7 @@ function Placement:_getLpdbData(...) | |||||
| local pointsReward = self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_POINTS .. 1) | ||||||
| local pointsReward2 = self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_POINTS .. 2) | ||||||
| local isQualified = self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_QUALIFIES .. '1') | ||||||
| local playerShare = tonumber(self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_PLAYER_SHARE .. 1)) or 0 | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why or |
||||||
|
|
||||||
| local lpdbData = { | ||||||
| image = image, | ||||||
|
|
@@ -262,6 +264,7 @@ function Placement:_getLpdbData(...) | |||||
| participantteam = (opponentType == Opponent.solo and players.p1team) | ||||||
| and Opponent.toName{template = players.p1team, type = 'team', extradata = {}} | ||||||
| or nil, | ||||||
| playershare = playerShare and tostring(playerShare) or nil, | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| }, | ||||||
| qualified = isQualified and 1 or 0 | ||||||
| -- TODO: We need to create additional LPDB Fields | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,6 +101,13 @@ function TeamParticipantsRepository.save(participant) | |
| lpdbData.individualprizemoney = lpdbData.prizemoney / numberOfPlayersOnTeam | ||
| end | ||
|
|
||
| -- Calculate individual playerShare | ||
| if lpdbData.playershare then | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you stored it into extradata |
||
| if activeOpponent.type ~= Opponent.team then | ||
| lpdbData.individualprizemoney = lpdbData.playershare | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here too extradata |
||
| end | ||
| end | ||
|
|
||
| mw.ext.LiquipediaDB.lpdb_placement(lpdbData.objectName, Json.stringifySubTables(lpdbData)) | ||
| end | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file is just for the vscode extensions
you can not actually add lpdb fields
you will have to push it into extradata