Skip to content

Commit

Permalink
guess button fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NaridaL committed Jul 17, 2020
1 parent 9f35fb8 commit 89753af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Calendar is hidden if the selected interval is larger than 31 days.
- The "clarity view" groups columns by day/week/month/year, depending on the selected interval. Selecting large intervals is useful to see the total booked time to a particular account.
- Fixed: GUESS-Button: `FOO-11` no longer matches clarity-task containing `FOO-111`.

## [2.5.0] - 2020-07-12

Expand Down
6 changes: 4 additions & 2 deletions zedd-app/src/components/TaskEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ export const TaskEditor = observer(
let guessClarityIntId: number | undefined = undefined
if (value.clarityTaskIntId === undefined) {
const keys = value.name.match(/[A-Z]+-\d+/g) ?? []
guessClarityIntId = clarityState.tasks.find((ct) => keys.some((key) => ct.name.includes(key)))
?.intId
const keyRegexes = keys.map((key) => new RegExp(key + '(?!\\d)'))
guessClarityIntId = clarityState.tasks.find((ct) =>
keyRegexes.some((regex) => ct.name.match(regex)),
)?.intId
}

return (
Expand Down

0 comments on commit 89753af

Please sign in to comment.