@@ -1754,96 +1754,77 @@ def __check_data_rows_have_been_processed(
1754
1754
"allDataRowsHaveBeenProcessed" ]
1755
1755
1756
1756
def get_overview (self , details = False ) -> Union [ProjectOverview , ProjectOverviewDetailed ]:
1757
- """Return the overview of a project.
1757
+ """Return the overview of a project.
1758
1758
1759
- This method returns the number of data rows per task queue and issues of a project,
1760
- which is equivalent to the Overview tab of a project.
1759
+ This method returns the number of data rows per task queue and issues of a project,
1760
+ which is equivalent to the Overview tab of a project.
1761
1761
1762
- Args:
1763
- details (bool, optional): Whether to include detailed queue information for review and rework queues.
1764
- Defaults to False.
1762
+ Args:
1763
+ details (bool, optional): Whether to include detailed queue information for review and rework queues.
1764
+ Defaults to False.
1765
1765
1766
- Returns:
1767
- Union[ProjectOverview, ProjectOverviewDetailed]: An object representing the project overview.
1768
- If `details` is False, returns a `ProjectOverview` object.
1769
- If `details` is True, returns a `ProjectOverviewDetailed` object.
1766
+ Returns:
1767
+ Union[ProjectOverview, ProjectOverviewDetailed]: An object representing the project overview.
1768
+ If `details` is False, returns a `ProjectOverview` object.
1769
+ If `details` is True, returns a `ProjectOverviewDetailed` object.
1770
1770
1771
- Raises:
1772
- Exception: If there is an error executing the query.
1771
+ Raises:
1772
+ Exception: If there is an error executing the query.
1773
1773
1774
- """
1775
- def _build_queue_details (overview_category : str , queue_type : str , total : int ):
1776
- """
1777
- Builds the queue details for a given overview category and queue type.
1774
+ """
1775
+ query = """query ProjectGetOverviewPyApi($projectId: ID!) {
1776
+ project(where: { id: $projectId }) {
1777
+ workstreamStateCounts {
1778
+ state
1779
+ count
1780
+ }
1781
+ taskQueues {
1782
+ queueType
1783
+ name
1784
+ dataRowCount
1785
+ }
1786
+ issues {
1787
+ totalCount
1788
+ }
1789
+ completedDataRowCount
1790
+ }
1791
+ }
1792
+ """
1778
1793
1779
- Args:
1780
- overview_category (str): The overview category.
1781
- queue_type (str): The queue type.
1782
- total (int): The total number of items in the queue.
1794
+ # Must use experimental to access "issues"
1795
+ result = self .client .execute (query , {"projectId" : self .uid },
1796
+ experimental = True )["project" ]
1783
1797
1784
- Returns:
1785
- dict: A dictionary containing the queue details.
1786
- - data (list): A list of dictionaries representing the queues.
1787
- Each dictionary contains the queue name and the number of data rows.
1788
- - total (int): The total number of data rows for the category
1789
- """
1798
+ # Reformat category names
1799
+ overview = {
1800
+ utils .snake_case (st ["state" ]): st ["count" ]
1801
+ for st in result .get ("workstreamStateCounts" )
1802
+ if st ["state" ] != "NotInTaskQueue"
1803
+ }
1804
+
1805
+ overview ["issues" ] = result .get ("issues" , {}).get ("totalCount" )
1806
+
1807
+ # Rename categories
1808
+ overview ["to_label" ] = overview .pop ("unlabeled" )
1809
+ overview ["total_data_rows" ] = overview .pop ("all" )
1810
+
1811
+ if not details :
1812
+ return ProjectOverview (** overview )
1813
+ else :
1814
+ # Build dictionary for queue details for review and rework queues
1815
+ for category in ["rework" , "review" ]:
1790
1816
queues = [
1791
1817
{tq ["name" ]: tq .get ("dataRowCount" )}
1792
1818
for tq in result .get ("taskQueues" )
1793
- if tq .get ("queueType" ) == queue_type
1819
+ if tq .get ("queueType" ) == f"MANUAL_ { category . upper () } _QUEUE"
1794
1820
]
1795
1821
1796
- return {
1822
+ overview [ f"in_ { category } " ] = {
1797
1823
"data" : queues ,
1798
- "total" : total
1799
- }
1800
-
1801
- query = """query ProjectGetOverviewPyApi($projectId: ID!) {
1802
- project(where: { id: $projectId }) {
1803
- workstreamStateCounts {
1804
- state
1805
- count
1806
- }
1807
- taskQueues {
1808
- queueType
1809
- name
1810
- dataRowCount
1811
- }
1812
- issues {
1813
- totalCount
1814
- }
1815
- completedDataRowCount
1824
+ "total" : overview [f"in_{ category } " ]
1816
1825
}
1817
- }
1818
- """
1819
-
1820
- # Must use experimental to access "issues"
1821
- result = self .client .execute (query , {"projectId" : self .uid },
1822
- experimental = True )["project" ]
1823
-
1824
- # Reformat category names
1825
- overview = {
1826
- utils .snake_case (st ["state" ]): st ["count" ]
1827
- for st in result .get ("workstreamStateCounts" )
1828
- if st ["state" ] != "NotInTaskQueue"
1829
- }
1830
-
1831
- overview ["issues" ] = result .get ("issues" , {}).get ("totalCount" )
1832
-
1833
- # Rename categories
1834
- overview ["to_label" ] = overview .pop ("unlabeled" )
1835
- overview ["total_data_rows" ] = overview .pop ("all" )
1836
-
1837
- if not details :
1838
- return ProjectOverview (** overview )
1839
- else :
1840
- # Build queue details for review and rework queues
1841
- for category in ["rework" , "review" ]:
1842
- overview [f"in_{ category } " ] = _build_queue_details (f"in_{ category } " ,
1843
- f"MANUAL_{ category .upper ()} _QUEUE" ,
1844
- overview [f"in_{ category } " ])
1845
-
1846
- return ProjectOverviewDetailed (** overview )
1826
+
1827
+ return ProjectOverviewDetailed (** overview )
1847
1828
1848
1829
def clone (self ) -> "Project" :
1849
1830
"""
0 commit comments