Created
June 4, 2013 19:45
-
-
Save qpfiffer/5708910 to your computer and use it in GitHub Desktop.
Functional fun!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rt = Factory.route_trip() | |
drops = rt.droppoint_set.all() | |
managers = [drop.droppointmembership_set.filter(is_drop_manager=True) | |
for drop in drops] | |
# flatten the list of managers: | |
managers = [manager for manager_list in managers for manager in manager_list] | |
credits = [manager.customer.credits.count() for manager in managers] | |
credits = reduce(lambda x, y: x + y, credits, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment