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

✨ Refactor useFetchTasks()'s select function #1216

Merged
merged 1 commit into from
Jul 28, 2023

Conversation

sjd78
Copy link
Member

@sjd78 sjd78 commented Jul 27, 2023

The motivation for this refactoring came while working on #1191 and trying to understand what tasks were given to the analysis table. The select function used by useFetchTasks() to filter by addon and to keep only the newest tasks per application id was confusing to read as written. This refactor simplifies the steps involved to use a typical stream processing approach.

Output of the refactored function is functionally identical to the original implementation.

@sjd78
Copy link
Member Author

sjd78 commented Jul 27, 2023

I submitted this PR mostly because I did the refactor when working on the other PR and didn't want to throw it out.

@codecov
Copy link

codecov bot commented Jul 27, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.04% 🎉

Comparison is base (e59e1d0) 44.04% compared to head (1a24ca0) 44.09%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1216      +/-   ##
==========================================
+ Coverage   44.04%   44.09%   +0.04%     
==========================================
  Files         177      177              
  Lines        4516     4511       -5     
  Branches     1007     1006       -1     
==========================================
  Hits         1989     1989              
+ Misses       2516     2511       -5     
  Partials       11       11              
Flag Coverage Δ
client 44.09% <0.00%> (+0.04%) ⬆️
server ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
client/src/app/queries/tasks.ts 17.14% <0.00%> (+2.14%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sjd78 sjd78 force-pushed the useFetchTasks-better-select branch 2 times, most recently from e26a3bc to 69b79f4 Compare July 27, 2023 22:28
@sjd78 sjd78 force-pushed the useFetchTasks-better-select branch from 69b79f4 to a26fee5 Compare July 28, 2023 13:47
The function used by `useFetchTasks()` to filter by addon and to
keep only the newest tasks per application id was confusing to
read as written.  This refactor simplifies the steps involved
to use a typical stream processing approach.

The output is functionally identical to the original implementation.

Signed-off-by: Scott J Dickerson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants