Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Refactor search filter #745

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/headline_filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ export const isMatch = (filterExpr) => {
//const filterClock = filterField.filter((f) => f.field.type === 'clock').map(timeFilter);
const filterSchedule = filterField.filter((f) => f.field.type === 'scheduled').map(timeFilter);
const filterDeadline = filterField.filter((f) => f.field.type === 'deadline').map(timeFilter);
const clockFilters = filterField.filter((f) => f.field.type === 'clock').map(timeFilter);

const filterTagsExcl = filterExpr.filter(filterFilter('tag', true)).map(words);
const filterCSExcl = filterExpr.filter(filterFilter('case-sensitive', true)).map(words);
Expand Down
4 changes: 1 addition & 3 deletions src/reducers/org.js
Original file line number Diff line number Diff line change
Expand Up @@ -1167,9 +1167,7 @@ export const setSearchFilterInformation = (state, action) => {
const headers = files.map((file) => file.get('headers'));

// show clocked times & sum if there is a clock search term
const clockFilters = searchFilterExpr
.filter((f) => f.type === 'field')
.filter((f) => f.field.type === 'clock');
// TODO these depend on clockFilters which is now in isMatch() ...
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will take me a time, too, to understand all those filters again. I moved the clock filter added by you, @tarnung, to isMatch – but I don't understand yet what your other lines do and how we can refactor that...

It's late ^^ I just wanted to make a note for now.

const filterFunctions = clockFilters.map(timeFilter);
const showClockedTimes = clockFilters.length !== 0;
state.setIn(['search', 'showClockedTimes'], showClockedTimes);
Expand Down