@@ -260,15 +260,16 @@ def gen_session_plays(xml):
260260 return (list (nums_sessions_with_x_plays .keys ()),
261261 list (nums_sessions_with_x_plays .values ()))
262262
263- def gen_cb_probability (xml , analysis ):
263+ # Currently broken
264+ """def gen_cb_probability(xml, analysis):
264265 # {combo length: (base number, cb number)
265266 base, cbs = analysis.combo_occurences, analysis.cbs_on_combo_len
266267
267268 # Find first combo that was never reached (0), starting with combo 1
268269 max_combo = base.index(0, 1)
269270 result = {i: int(cbs[i]/base[i]) for i in range(max_combo)[:10] if base[i] >= 0}
270271 x_list = range(max_combo)
271- return (x_list , [cbs [i ]/ base [i ] for i in x_list ])
272+ return (x_list, [cbs[i]/base[i] for i in x_list])"""
272273
273274def gen_plays_per_week (xml ):
274275 datetimes = [parsedate (s .findtext ("DateTime" )) for s in iter_scores (xml )]
@@ -339,6 +340,18 @@ def gen_session_rating_improvement(xml):
339340
340341 return ((datetimes , lengths , sizes ), ids )
341342
343+ # Returns tuple of `(max_combo_chart_element, max_combo_int)`
344+ def find_longest_combo (xml ):
345+ max_combo_chart = None
346+ max_combo = 0
347+ for chart in xml .iter ("Chart" ):
348+ for score in iter_scores (chart ):
349+ combo = int (score .findtext ("MaxCombo" ))
350+ if combo > max_combo :
351+ max_combo = combo
352+ max_combo_chart = chart
353+ return max_combo_chart , max_combo
354+
342355# Returns dict with pack names as keys and the respective "pack liking"
343356# as value. The liking value is currently simply the amount of recent
344357# plays in the pack. Recent = in the last `timespan_months` months
@@ -419,16 +432,15 @@ def gen_text_general_info(xml, r):
419432 if r : # If ReplaysAnalysis is avilable
420433 total_notes_string = util .abbreviate (r .total_notes , min_precision = 3 )
421434
422- chart = r . longest_combo [ 1 ]
435+ chart , combo = find_longest_combo ( xml )
423436 long_combo_chart = f'"{ chart .get ("Pack" )} -> "{ chart .get ("Song" )} "'
424- long_combo_str = f"{ r . longest_combo [ 0 ] } on { long_combo_chart } "
437+ long_combo_str = f"{ combo } on { long_combo_chart } "
425438
426439 chart = r .longest_mcombo [1 ]
427440 long_mcombo_chart = f'"{ chart .get ("Pack" )} -> "{ chart .get ("Song" )} "'
428441 long_mcombo_str = f"{ r .longest_mcombo [0 ]} on { long_mcombo_chart } "
429442 else :
430443 total_notes_string = "[please load replay data]"
431- long_combo_str = "[please load replay data]"
432444 long_mcombo_str = "[please load replay data]"
433445
434446 scores = list (iter_scores (xml ))
0 commit comments