astoria-tech / volunteer-dispatch

Slackbot to coordinate errand volunteering
MIT License
24 stars 9 forks source link

Count volunteer's assigned tasks #43

Closed bronzehedwick closed 4 years ago

bronzehedwick commented 4 years ago

This implementation gets the total amount of volunteers and sets that to a Map, with the user id as the key and the count of their tasks as the value.

This Map is then passed through the function chain to end up in dispatch where each volunteer's id is retrieved from the Map to get the amount of tasks assigned. This scope passing as function argument could be made more elegant.

Also, re-work the Airtable queries to grab only the data we need, instead of doing the filtering after the fact.

On a small note, replace the volunteerLine constant with a direct return. While the intermediate constant is not necessary, the real reason to do this was to make ESLint happy with max line length.

bronzehedwick commented 4 years ago

Thanks @bronzehedwick!

I've done a refactor of the src/slack/ dir in #42 that will impact these changes superficially (based on a quick glance, looks like just file paths for requires and method names will change a bit here and there).

Just an FYI for now. I'm happy to pitch in on any changes to make the merge successful.

Thanks for reviewing @ashryanbeats! I'll take a swing at refactoring to your detailed explanations (thanks!). I might reach out if I get confused :)