Org Web Adapter

hungryroot/jira/be_5302_replace_double_for_loop_list_comprehension_with_pydash_flatten.org

ID
0e63f161-ea3f-4d82-8b32-96aaa35ab886

BE-5302 Replace double for loop list comprehension with pydash 'flatten'

- source :: https://hungryroot.atlassian.net/browse/BE-5302

- tags :: Hungryroot API Project

- epic :: EP-411 Eng Parking Lot

- sprint :: HR BE Sprint 101

- status :: Status - Complete

Tasks

DONE Fix double loop list comprehension

workhungryrootchoreep411be5302sprint101
ID
a6674982-c01b-e833-97fa-ecdb9475238e

Description

https://github.com/hungryroot/hungryroot/blob/46462a6a82e201233d80bb628107b6728424c8bb/app/services/platform/cyo/cyo_mixin.py#L113

Instead of:

#+begin_src python

candidate_list = {c for sublist in candidates.values() for c in sublist}

#+end_src

which can be hard to read. Since we already have pydash and use it in many places, we can change this to something like:

#+begin_src python

from pydash import flatten as _flatten

candidate_list = set(_flatten(candidates.values()))

#+end_src