Skip to content

Commit

Permalink
Sort more info responses by number of awards
Browse files Browse the repository at this point in the history
  • Loading branch information
evil-morfar committed Oct 24, 2024
1 parent c39f782 commit 772e4c5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Modules/History/lootHistory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ function LootHistory:UpdateMoreInfo(rowFrame, cellFrame, dat, cols, row, realrow
end
tip:AddLine(" ")
tip:AddLine(L["Total awards"])
table.sort(moreInfoData[row.name].totals.responses, function(a,b) return type(a[4]) == "number" and type(b[4]) == "number" and a[4] < b[4] or false end)
table.sort(moreInfoData[row.name].totals.responses, function(a,b) return type(a[2]) == "number" and type(b[2]) == "number" and a[2] > b[2] or false end)
for _, v in pairs(moreInfoData[row.name].totals.responses) do
local r,g,b
if v[3] then r,g,b = unpack(v[3],1,3) end
Expand Down Expand Up @@ -1402,6 +1402,7 @@ function LootHistory.RightClickMenu(menu, level)
entry.tokenRoll = nil
entry.relicRoll = nil
data.response = i
entry.typeCode = "default"
data.cols[6].args = {color = entry.color, response = entry.response, responseID = i}
LootHistory.frame.st:SortData()
addon:SendMessage("RCHistory_ResponseEdit", data)
Expand Down Expand Up @@ -1430,9 +1431,8 @@ function LootHistory.RightClickMenu(menu, level)
entry.response = addon:GetResponse(k,i).text
entry.color = {addon:GetResponseColor(k, i)}
entry.isAwardReason = nil
entry.tokenRoll = nil
entry.relicRoll = nil
data.response = i
entry.typeCode = k
data.cols[6].args = {color = entry.color, response = entry.response, responseID = i}
LootHistory.frame.st:SortData()
addon:SendMessage("RCHistory_ResponseEdit", data)
Expand All @@ -1455,6 +1455,7 @@ function LootHistory.RightClickMenu(menu, level)
entry.response = addon:GetResponse("default",k).text
entry.color = {addon:GetResponseColor("default", k)}
entry.isAwardReason = nil
entry.typeCode = "default"
data.response = k
data.cols[6].args = {color = entry.color, response = entry.response, responseID = k}
LootHistory.frame.st:SortData()
Expand Down
2 changes: 2 additions & 0 deletions Modules/votingFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,8 @@ function RCVotingFrame:UpdateMoreInfo(row, data)
end
tip:AddLine(" ") -- spacer
tip:AddLine(_G.TOTAL)
table.sort(moreInfoData[name].totals.responses,
function(a, b) return type(a[2]) == "number" and type(b[2]) == "number" and a[2] > b[2] or false end)
for _, v in pairs(moreInfoData[name].totals.responses) do
if v[3] then r,g,b = unpack(v[3],1,3) end
tip:AddDoubleLine(v[1], v[2], r or 1,g or 1,b or 1, r or 1,g or 1,b or 1)
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

Now properly tracks responses from item groups other than default and tier token.

Responses are now sorted by number of awards.

## Bugfixes

Expand Down

0 comments on commit 772e4c5

Please sign in to comment.