@@ -185,7 +185,7 @@ def _create_pie_plot_tdd_levels():
185185    _save_plot (plt , "TDD Categories" )
186186
187187
188- def  _create_pie_plot_tdd_overall ():
188+ def  _create_pie_plot_overall_tdd_raw ():
189189    # Read data from the author_data csv 
190190    repo_data  =  file_utils .read_csv ("repo_data" )
191191
@@ -227,12 +227,55 @@ def _create_pie_plot_tdd_overall():
227227    # Save the plot 
228228    _save_plot (plt , "Overall TDD Usage Raw" )
229229
230+ 
231+ def  _create_pie_overall_tdd_percentage ():
232+     # Read data from the author_data csv 
233+     repo_data  =  file_utils .read_csv ("repo_data" )
234+ 
235+     # Initialize Counters 
236+     total  =  0 
237+     data  =  [0 , 0 ]
238+ 
239+     for  repo  in  repo_data :
240+         data [0 ] +=  int (repo ['Test Before' ])
241+         data [1 ] +=  int (repo ['Test After' ])
242+         total  +=  int (repo ['Test Before' ]) +  int (repo ['Test After' ])
243+ 
244+     # Convert the data into percentages using a lambda function and map 
245+     percentages  =  list (map (lambda  x : x  /  max (1 , total ) *  100 , data ))
246+ 
247+ 
248+     # Update labels to include percentage values for each slice 
249+     labels  =  ['TDD' , 'Not TDD' ]
250+     for  i  in  range (len (labels )):
251+         labels [i ] =  labels [i ] +  ' - '  +  str (round (percentages [i ], 1 )) +  '%' 
252+ 
253+     # Clear any existing plot 
254+     plt .clf ()
255+ 
256+     # Plot the pie 
257+     colors  =  ['palegreen' , 'lightblue' ]
258+     patches , texts , x  =  plt .pie (percentages , colors = colors , autopct = '%1.1f%%' )
259+ 
260+     # Plot the legend 
261+     plt .legend (patches , labels , loc = "upper left" )
262+ 
263+     # Set the title and specify axis setting 
264+     plt .axis ('equal' )
265+     plt .title ("Overall TDD Percentage" )
266+     plt .rcParams ["figure.figsize" ] =  [7.5 , 4.25 ]
267+     plt .rcParams ["figure.autolayout" ] =  True 
268+ 
269+     # Save the plot 
270+     _save_plot (plt , "Overall TDD Percentage" )
271+ 
230272def  create_plots ():
231273    _create_box_plot ()
232274    _create_size_impact_plot ()
233275    _create_avg_commit_size_plot ()
234276    _create_pie_plot_tdd_levels ()
235-     _create_pie_plot_tdd_overall ()
277+     _create_pie_plot_overall_tdd_raw ()
278+     _create_pie_overall_tdd_percentage ()
236279
237280# REMEMBER TO REMOVE THESE 
238281create_plots ()
@@ -244,6 +287,5 @@ def create_plots():
244287todo -  
245288plot like the TDD cagetories pie, but for repo instead of author - modify _create_pie_plot_tdd_levels 
246289bar chart for tdd percentace per langange - ignoring during 
247- overall tdd percentage - pie of before and after, excluding during 
248290
249291''' 
0 commit comments