Quantcast

Can now also filter by specName.

Peter Eliasson [09-25-16 - 10:49]
Can now also filter by specName.
Filename
src/gui.lua
src/report.lua
diff --git a/src/gui.lua b/src/gui.lua
index c40d110..af96d31 100644
--- a/src/gui.lua
+++ b/src/gui.lua
@@ -138,13 +138,15 @@ function gui:CreateFilterEntry(filterId, filterValue)
 		filterText = "Time: " .. date(RAID_TIME_FORMAT, filterValue);
 	elseif filterId == "name" then
 		filterText = "Name: " .. filterValue;
-	else
+	elseif filterId == "specName" then
+		filterText = "Spec: " .. filterValue
+	else
 		return nil;
 	end

 	local entryBtn = AceGUI:Create("Button")
 	entryBtn:SetText(filterText);
-	entryBtn:SetRelativeWidth(0.5);
+	entryBtn:SetRelativeWidth(0.3);
 	entryBtn:SetCallback("OnClick", function()
 		self:UnsetParseFilter(filterId);
 	end);
@@ -240,7 +242,13 @@ function gui:CreateHighScoreParseEntry(parse, role, rank)
 				self:ToggleParseFilter("name", parse.name);
 			end
 		},
-		{"spec", parse.specName},
+		{"spec",
+			parse.specName,
+			nil,
+			function()
+				self:ToggleParseFilter("specName", parse.specName)
+			end
+		},
 		{"ilvl", parse.itemLevel},
 		{"time",
 			date(RAID_TIME_FORMAT, parse.startTime),
diff --git a/src/report.lua b/src/report.lua
index bd25af3..175cde7 100644
--- a/src/report.lua
+++ b/src/report.lua
@@ -97,6 +97,8 @@ local function createFilterString(filters)
 			filterString = filterString .. format("Name: %s", filterValue);
 		elseif filterKey == "startTime" then
 			filterString = filterString .. format("Time: %s", date(FILTER_START_TIME_FORMAT, filterValue));
+		elseif filterKey == "specName" then
+			filterString = filterString .. format("Spec: %s", filterValue)
 		else
 			filterString = filterString .. format("%s: %s", filterKey, filterValue);
 		end