Merge pull request #179 from got2bhockey/master

Add win/loss stats to Grafana
This commit is contained in:
Thomas Smyth 2021-03-13 21:40:24 +00:00 committed by GitHub
commit fb5e3b9523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3612 additions and 3437 deletions

View File

@ -16,7 +16,7 @@
"gnetId": null,
"graphTooltip": 2,
"id": 7,
"iteration": 1614468639214,
"iteration": 1615585228169,
"links": [],
"panels": [
{
@ -29,7 +29,7 @@
"datatablePagingType": "simple_numbers",
"datatableTheme": "basic_theme",
"description": "This panel does not sort top scores. ",
"emptyData": false,
"emptyData": true,
"fieldConfig": {
"defaults": {
"custom": {}
@ -3326,6 +3326,181 @@
"title": "Weapons",
"type": "grafana-piechart-panel",
"valueName": "current"
},
{
"columnAliases": [],
"columnFiltersEnabled": false,
"columnWidthHints": [],
"columns": [],
"compactRowsEnabled": false,
"datasource": "MySQL",
"datatablePagingType": "simple_numbers",
"datatableTheme": "basic_theme",
"description": "",
"emptyData": false,
"fieldConfig": {
"defaults": {
"custom": {}
},
"overrides": []
},
"fontSize": "100%",
"gridPos": {
"h": 10,
"w": 12,
"x": 12,
"y": 91
},
"hoverEnabled": true,
"id": 36,
"infoEnabled": true,
"lengthChangeEnabled": true,
"orderColumnEnabled": true,
"pagingTypes": [
{
"$$hashKey": "object:227",
"text": "Page number buttons only",
"value": "numbers"
},
{
"$$hashKey": "object:228",
"text": "'Previous' and 'Next' buttons only",
"value": "simple"
},
{
"$$hashKey": "object:229",
"text": "'Previous' and 'Next' buttons, plus page numbers",
"value": "simple_numbers"
},
{
"$$hashKey": "object:230",
"text": "'First', 'Previous', 'Next' and 'Last' buttons",
"value": "full"
},
{
"$$hashKey": "object:231",
"text": "'First', 'Previous', 'Next' and 'Last' buttons, plus page numbers",
"value": "full_numbers"
},
{
"$$hashKey": "object:232",
"text": "'First' and 'Last' buttons, plus page numbers",
"value": "first_last_numbers"
}
],
"panelHeight": null,
"pluginVersion": "7.1.1",
"rowNumbersEnabled": false,
"rowsPerPage": 20,
"scroll": true,
"scrollHeight": "default",
"searchEnabled": true,
"showCellBorders": false,
"showHeader": true,
"showRowBorders": true,
"sort": {
"col": 0,
"desc": true
},
"sortByColumns": [
{
"columnData": "Kills",
"sortMethod": "desc"
}
],
"sortByColumnsData": [
[
3,
"desc"
]
],
"stripedRowsEnabled": true,
"styles": [
{
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"pattern": "Time",
"type": "date"
},
{
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"decimals": 2,
"pattern": "/.*/",
"splitPattern": "/ /",
"thresholds": [],
"type": "string",
"unit": "short"
}
],
"targets": [
{
"format": "table",
"group": [],
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT DISTINCTROW\n layer,\n NTH_VALUE(LW.winner, 1) OVER (PARTITION BY LW.layer) AS \"Most Frequent Winner\",\n NTH_VALUE(LW.wins, 1) OVER (PARTITION BY LW.layer) AS \"Most Frequent Winner Wins\",\n (NTH_VALUE(LW.wins, 1) OVER (PARTITION BY LW.layer) / (NTH_VALUE(LW.wins, 1) OVER (PARTITION BY LW.layer) + NTH_VALUE(LW.wins, 2) OVER (PARTITION BY LW.layer))) * 100 AS \"Most Frequent Winner Win Percentage\",\n NTH_VALUE(LW.winner, 2) OVER (PARTITION BY LW.layer) AS \"Least Frequent Winner\",\n NTH_VALUE(LW.wins, 2) OVER (PARTITION BY LW.layer) AS \"Least Frequent Winner Count\",\n (NTH_VALUE(LW.wins, 2) OVER (PARTITION BY LW.layer) / (NTH_VALUE(LW.wins, 1) OVER (PARTITION BY LW.layer) + NTH_VALUE(LW.wins, 2) OVER (PARTITION BY LW.layer))) * 100 AS \"Least Frequent Winner Win Percentage\"\nFROM (\n SELECT\n M.layer,\n M.winner,\n COUNT(*) AS \"wins\"\n FROM dblog_matches M\n WHERE\n M.layer IS NOT NULL AND\n M.winner IS NOT NULL\n GROUP BY M.layer, M.winner\n ORDER BY wins DESC\n) LW;\n",
"refId": "A",
"select": [
[
{
"params": [
"id"
],
"type": "column"
}
]
],
"table": "DBLog_TickRates",
"timeColumn": "time",
"timeColumnType": "timestamp",
"where": [
{
"name": "$__timeFilter",
"params": [],
"type": "macro"
}
]
}
],
"themeOptions": {
"dark": "./styles/dark.scss",
"light": "./styles/light.scss"
},
"themes": [
{
"$$hashKey": "object:208",
"disabled": false,
"text": "Basic",
"value": "basic_theme"
},
{
"$$hashKey": "object:209",
"disabled": true,
"text": "Bootstrap",
"value": "bootstrap_theme"
},
{
"$$hashKey": "object:210",
"disabled": true,
"text": "Foundation",
"value": "foundation_theme"
},
{
"$$hashKey": "object:211",
"disabled": true,
"text": "ThemeRoller",
"value": "themeroller_theme"
}
],
"timeFrom": null,
"timeShift": null,
"title": "Matches - Win/Loss Comparison",
"transform": "table",
"type": "briangann-datatable-panel"
}
],
"refresh": false,
@ -3444,5 +3619,5 @@
"timezone": "",
"title": "Server Overview",
"uid": "n7Xl7jEWx",
"version": 4
"version": 13
}

View File

@ -53,7 +53,7 @@ export default async function fetchAdminLists(adminLists) {
try {
const group = groups[`${idx}-${m.groups.groupID}`];
const perms = {};
for (const groupPerm of group) perms[groupPerm] = true;
for (const groupPerm of group) perms[groupPerm.toLowerCase()] = true;
const steamID = m.groups.steamID;
if (steamID in admins) {