shorten csv headers
authorJacob Lifshay <programmerjake@gmail.com>
Fri, 24 Sep 2021 19:09:29 +0000 (12:09 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Fri, 24 Sep 2021 19:09:29 +0000 (12:09 -0700)
src/budget_sync/test/test_write_budget_csv.py
src/budget_sync/write_budget_csv.py

index b412f08ede70f4f7f31bd51425bb610f69c59191..a95a686d54382d29b603b6a2b271451c7a0e04c3 100644 (file)
@@ -67,11 +67,11 @@ class TestWriteBudgetMarkdown(unittest.TestCase):
 
 [[!table format=csv file="/output_dir/milestone 2.csv"]]""",
                 '/output_dir/milestone 1.csv': b"""\
-bug_id,budget_excluding_subtasks,budget_including_subtasks,fixed_budget_excluding_subtasks,fixed_budget_including_subtasks,submitted_excluding_subtasks,paid_excluding_subtasks,person1 (planned amt),person1 (req amt),person1 (req date),person1 (paid amt),person1 (paid date),person2 (planned amt),person2 (req amt),person2 (req date),person2 (paid amt),person2 (paid date)
+bug_id,excl_subtasks,inc_subtasks,fixed_excl_subtasks,fixed_inc_subtasks,req_excl_subtasks,paid_excl_subtasks,person1 (planned amt),person1 (req amt),person1 (req date),person1 (paid amt),person1 (paid date),person2 (planned amt),person2 (req amt),person2 (req date),person2 (paid amt),person2 (paid date)
 1,1000,1000,1000,1000,421,421,579,0,,0,,421,421,,421,2020-01-01
 """,
                 '/output_dir/milestone 2.csv': b"""\
-bug_id,budget_excluding_subtasks,budget_including_subtasks,fixed_budget_excluding_subtasks,fixed_budget_including_subtasks,submitted_excluding_subtasks,paid_excluding_subtasks
+bug_id,excl_subtasks,inc_subtasks,fixed_excl_subtasks,fixed_inc_subtasks,req_excl_subtasks,paid_excl_subtasks
 """
             })
     # TODO: add more test cases
index c0404215de0d0f93a3295cb75ae4e416e0790bc9..b67c50f1012b96d2cbf6c5bd2b484a7c28d02dcb 100644 (file)
@@ -12,12 +12,12 @@ from budget_sync.write_budget_markdown import markdown_escape
 def _budget_csv_row(budget_graph: BudgetGraph, milestone: Milestone, node: Optional[Node]) -> Dict[str, str]:
     row_fns: Dict[str, Callable[[Node], Any]] = {
         'bug_id': lambda node: node.bug.id,
-        'budget_excluding_subtasks': lambda node: node.budget_excluding_subtasks,
-        'budget_including_subtasks': lambda node: node.budget_including_subtasks,
-        'fixed_budget_excluding_subtasks': lambda node: node.fixed_budget_excluding_subtasks,
-        'fixed_budget_including_subtasks': lambda node: node.fixed_budget_including_subtasks,
-        'submitted_excluding_subtasks': lambda node: node.submitted_excluding_subtasks,
-        'paid_excluding_subtasks': lambda node: node.paid_excluding_subtasks,
+        'excl_subtasks': lambda node: node.budget_excluding_subtasks,
+        'inc_subtasks': lambda node: node.budget_including_subtasks,
+        'fixed_excl_subtasks': lambda node: node.fixed_budget_excluding_subtasks,
+        'fixed_inc_subtasks': lambda node: node.fixed_budget_including_subtasks,
+        'req_excl_subtasks': lambda node: node.submitted_excluding_subtasks,
+        'paid_excl_subtasks': lambda node: node.paid_excluding_subtasks,
     }
     milestone_people = budget_graph.milestone_people[milestone]