Skip to content

Commit

Permalink
Implement Mean Score and Average Score Range Filters (closes #149)
Browse files Browse the repository at this point in the history
  • Loading branch information
Koopzington committed Jun 14, 2024
1 parent c8db516 commit b171478
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 2024-06-14
- New Mean Score and Average Score filters were added [#149](https://github.com/Koopzington/anitools/issues/149)

## 2024-06-06
- Improved handling of errors and abortion of running requests caused by user interactions
- Mapper: Users can now get a list of past votes and are able to revoke them if they want to
Expand Down
22 changes: 22 additions & 0 deletions src/Filters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class Filters extends EventTarget {
'staff',
'episodes',
'volumes',
'meanScore',
'avgScore',
'mcCount',
'showAdult',
],
Expand All @@ -60,6 +62,8 @@ class Filters extends EventTarget {
'staff',
'episodes',
'volumes',
'meanScore',
'avgScore',
'mcCount',
'muPublisher',
'muPublication',
Expand Down Expand Up @@ -91,6 +95,8 @@ class Filters extends EventTarget {
'awcCommunityList',
'episodes',
'totalRuntime',
'meanScore',
'avgScore',
'mcCount',
'showAdult',
],
Expand Down Expand Up @@ -249,6 +255,14 @@ class Filters extends EventTarget {
type: 'range',
label: 'Main Characters',
},
meanScore: {
type: 'range',
label: 'Mean Score',
},
avgScore: {
type: 'range',
label: 'Average Score',
},
showAdult: {
type: 'checkbox',
label: 'Show Adult entries',
Expand Down Expand Up @@ -359,6 +373,8 @@ class Filters extends EventTarget {
episodes: HTMLInputElement,
volumes: HTMLInputElement,
mcCount: HTMLInputElement,
meanScore: HTMLInputElement,
avgScore: HTMLInputElement,
showAdult: HTMLInputElement,
muPublisher: Tagify | undefined,
muPublication: Tagify | undefined,
Expand Down Expand Up @@ -641,6 +657,12 @@ class Filters extends EventTarget {
if (this.filters.mcCount !== undefined) {
this.updateRangeFilter(this.filters.mcCount, filterValues.mcCount)
}
if (this.filters.meanScore !== undefined) {
this.updateRangeFilter(this.filters.meanScore, [0, 100])
}
if (this.filters.avgScore !== undefined) {
this.updateRangeFilter(this.filters.avgScore, [0, 100])
}
if (this.filters.bloodType !== undefined) {
this.filters.bloodType.whitelist = filterValues.blood_type.map((v) => { return {value: v, text: v}})
}
Expand Down

0 comments on commit b171478

Please sign in to comment.