@@ -120,10 +120,12 @@ def get_nonbillable_pis(self) -> list[str]:
120120 def get_nonbillable_projects (self ) -> pandas .DataFrame :
121121 """
122122 Returns dataframe of nonbillable projects for current invoice month
123- The dataframe has 3 columns: Project Name, Cluster, Is Timed
123+ The dataframe has 4 columns: Project Name, Cluster, Is Timed, Is Billable Override
124124 1. Project Name: Name of the nonbillable project
125125 2. Cluster: Name of the cluster for which the project is nonbillable, or None meaning all clusters
126126 3. Is Timed: Boolean indicating if the nonbillable status is time-bound
127+ 4. Is Billable Override: Optional boolean override from projects.yaml
128+ indicating whether matching projects should be treated as billable
127129 """
128130
129131 def _is_in_time_range (timed_object ) -> bool :
@@ -140,33 +142,41 @@ def _is_in_time_range(timed_object) -> bool:
140142 for project in projects_dict :
141143 project_name = project ["name" ]
142144 cluster_list = project .get ("clusters" )
145+ is_billable = project .get ("is_billable" , False )
143146
144147 if project .get ("start" ):
145148 if not _is_in_time_range (project ):
146149 continue
147150
148151 if cluster_list :
149152 for cluster in cluster_list :
150- project_list .append ((project_name , cluster ["name" ], True ))
153+ project_list .append (
154+ (project_name , cluster ["name" ], True , is_billable )
155+ )
151156 else :
152- project_list .append ((project_name , None , True ))
157+ project_list .append ((project_name , None , True , is_billable ))
153158 elif cluster_list :
154159 for cluster in cluster_list :
155160 cluster_start_time = cluster .get ("start" )
156161 if cluster_start_time :
157162 if _is_in_time_range (cluster ):
158- project_list .append ((project_name , cluster ["name" ], True ))
163+ project_list .append (
164+ (project_name , cluster ["name" ], True , is_billable )
165+ )
159166 elif not cluster_start_time :
160- project_list .append ((project_name , cluster ["name" ], False ))
167+ project_list .append (
168+ (project_name , cluster ["name" ], False , is_billable )
169+ )
161170 else :
162- project_list .append ((project_name , None , False ))
171+ project_list .append ((project_name , None , False , is_billable ))
163172
164173 return pandas .DataFrame (
165174 project_list ,
166175 columns = [
167176 invoice .NONBILLABLE_PROJECT_NAME ,
168177 invoice .NONBILLABLE_CLUSTER_NAME ,
169178 invoice .NONBILLABLE_IS_TIMED ,
179+ invoice .NONBILLABLE_IS_BILLABLE_OVERRIDE ,
170180 ],
171181 )
172182
0 commit comments