Skip to content

Commit e6c0b27

Browse files
committed
fix: category filtering not working (#531)
1 parent e3b85ab commit e6c0b27

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@
3131
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
3232
"@babel/preset-env": "^7.28.0",
3333
"@crowdin/crowdin-api-client": "^1.46.0",
34-
"@rsdoctor/rspack-plugin": "^1.1.10",
35-
"@rspack/cli": "^1.4.10",
36-
"@rspack/core": "^1.4.10",
34+
"@rsdoctor/rspack-plugin": "^1.2.1",
35+
"@rspack/cli": "^1.4.11",
36+
"@rspack/core": "^1.4.11",
3737
"@swc/core": "^1.13.3",
3838
"@swc/jest": "^0.2.39",
39-
"@types/chrome": "0.1.1",
39+
"@types/chrome": "0.1.3",
4040
"@types/decompress": "^4.2.7",
4141
"@types/jest": "^30.0.0",
42-
"@types/node": "^24.1.0",
42+
"@types/node": "^24.2.1",
4343
"@types/punycode": "^2.1.4",
44-
"@vue/babel-plugin-jsx": "^1.4.0",
44+
"@vue/babel-plugin-jsx": "^1.5.0",
4545
"babel-loader": "^10.0.0",
4646
"commitlint": "^19.8.1",
4747
"css-loader": "^7.1.2",
@@ -53,8 +53,8 @@
5353
"postcss": "^8.5.6",
5454
"postcss-loader": "^8.1.1",
5555
"postcss-rtlcss": "^5.7.1",
56-
"puppeteer": "^24.15.0",
57-
"sass": "^1.89.2",
56+
"puppeteer": "^24.16.0",
57+
"sass": "^1.90.0",
5858
"sass-loader": "^16.0.5",
5959
"style-loader": "^4.0.0",
6060
"ts-loader": "^9.5.2",
@@ -67,7 +67,7 @@
6767
"web-ext": "^8.9.0"
6868
},
6969
"dependencies": {
70-
"@element-plus/icons-vue": "^2.3.1",
70+
"@element-plus/icons-vue": "^2.3.2",
7171
"@vueuse/core": "^13.6.0",
7272
"countup.js": "^2.9.0",
7373
"echarts": "^6.0.0",

src/service/stat-service/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import siteDatabase from "@db/site-database"
1212
import statDatabase, { type StatCondition } from "@db/stat-database"
1313
import { groupBy } from "@util/array"
1414
import { judgeVirtualFast } from "@util/pattern"
15-
import { distinctSites, SiteMap } from "@util/site"
15+
import { CATE_NOT_SET_ID, distinctSites, SiteMap } from "@util/site"
1616
import { isGroup, isNormalSite, isSite } from "@util/stat"
1717
import { log } from "../../common/logger"
1818
import CustomizedHostMergeRuler from "../components/host-merge-ruler"
@@ -112,6 +112,11 @@ interface StatService {
112112
canReadRemote(): Promise<boolean>
113113
}
114114

115+
function filterByCateId(itemCateId: number | undefined, cateIds: number[] | undefined): boolean {
116+
if (!cateIds?.length) return true
117+
return cateIds.includes(itemCateId ?? CATE_NOT_SET_ID)
118+
}
119+
115120
/**
116121
* Service of timer
117122
* @since 0.0.5
@@ -193,7 +198,7 @@ class StatServiceImpl implements StatService {
193198
siteRows = siteRows
194199
.filter(({ siteKey: { host: siteHost } }) => !host || host === siteHost)
195200
.filter(({ siteKey: { host: siteHost }, alias }) => !query || siteHost.includes(query) || !!alias?.includes(query))
196-
.filter(({ cateId }) => !cateIds?.length || (cateId && cateIds.includes(cateId)))
201+
.filter(({ cateId }) => filterByCateId(cateId, cateIds))
197202
// Merge by date
198203
needMergeDate && (siteRows = mergeDate(siteRows))
199204
// Sort

0 commit comments

Comments
 (0)