Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5
erp5
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Merge Requests 114
    • Merge Requests 114
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Jobs
  • Commits
  • nexedi
  • erp5erp5
  • Merge Requests
  • !1054

Open
Opened Feb 18, 2020 by Jérome Perrin@jerome
  • Report abuse
Report abuse

WIP: inventory api: group by time interval list

This is an old patch (used in production for months, but this version is a bit different, I will have to check again that it's still OK from query performance point of view) that I'm cleaning up and trying to merge.

This allow to group inventory results by arbitrary time intervals.

What's still being discussed / considered:

  • is it cool to pass intervals as a list ? passing a mapping and getting back the key on brain seems a bit better:
inventory_list = portal.portal_simulation.getInventoryList(group_by_time_sequence_mapping={key1: {'from_date': DateTime()}, key2: {'at_date': DateTime()})
inventory_dict_by_time_sequence = {brain.time_sequence_key: brain.inventory for brain in inventory_list}
assert key1 in inventory_dict_by_time_sequence
assert key2 in inventory_dict_by_time_sequence

a bit like we can do:

inventory_list = portal.portal_simulation.getInventoryList(group_by_node=True, node_uid=(node1.getUid(), node2.getUid())
inventory_dict_by_node = {brain.node_value: brain.inventory for brain in inventory_list}
assert node1 in inventory_dict_by_node
assert node2 in inventory_dict_by_node
  • if we look at underlying query, it's not only "group by", so maybe this parameter should use another name ? (but from inventory, this is seems similar concept)

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b feat/inventory_api_group_by_time_interval_list origin/feat/inventory_api_group_by_time_interval_list

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout origin/master
git merge --no-ff feat/inventory_api_group_by_time_interval_list

Step 4. Push the result of the merge to GitLab

git push origin master

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

  • Discussion 1
  • Commits 2
  • Pipelines 1
  • Changes 4
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
0
Labels
None
Assign labels
  • View project labels
Reference: nexedi/erp5!1054
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备14008524号