fix an error with the all time date range for role stats.

This commit is contained in:
iamBadgers
2024-06-08 23:07:20 -07:00
parent 9c87485d4e
commit 68433b6836
3 changed files with 7 additions and 5 deletions

View File

@@ -7,7 +7,8 @@
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/",
"dev": "npx tsc && node dist/app.js"
"dev": "npx tsc && node dist/app.js",
"build": "npx tsc"
},
"keywords": [],
"author": "",

View File

@@ -26,7 +26,7 @@ function getYearNumber(monthId: number): number {
}
function monthIdToStartSeconds(monthId: number): number {
if (monthId) {
if (monthId != -1) {
const yearNumber = getYearNumber(monthId)
const monthNumber = getMonthNumber(monthId)
return new Date(yearNumber, monthNumber, 1).getTime() / 1000
@@ -35,12 +35,12 @@ function monthIdToStartSeconds(monthId: number): number {
}
function monthIdToEndSeconds(monthId: number): number {
if (monthId) {
if (monthId != -1) {
const yearNumber = getYearNumber(monthId)
const monthNumber = getMonthNumber(monthId)
return new Date(yearNumber, monthNumber + 1, -1).getTime() / 1000
}
return 0
return Number.MAX_SAFE_INTEGER
}
export function addRushStatsApis(app, jsonParser) {

View File

@@ -183,11 +183,13 @@ async function loadData() {
monthId: dateSelect.value
})
gameStats.value = gameStatsResponse.data
console.log(gameStatsResponse.data)
const roleStatsResponse = await axios.post('/api/serverstats/rolestats', {
monthId: dateSelect.value
})
roleStats.value = roleStatsResponse.data
console.log(roleStatsResponse.data)
}
function buildDateItems() {
@@ -260,7 +262,6 @@ watch(chartSelect, async (newValue: ChartType, oldValue: ChartType) => {
})
onMounted(async () => {
console.log(dateItems)
if (!route.query.monthId) {
router.replace({ query: { monthId: -1 } })
} else {