@@ -170,17 +170,12 @@ def get_tactic(self, tactic, height, width, config, colors=[], scores=[], subtec
170170 """
171171 offset = 0
172172 column = G (ty = 2 )
173+ for a in tactic .subtechniques :
174+ self ._copy_scores (tactic .subtechniques [a ],scores ,tactic .tactic .name , exclude )
173175 for x in tactic .techniques :
174176 if any (x .id == y [0 ] and (y [1 ] == self .h .convert (tactic .tactic .name ) or not y [1 ]) for y in exclude ):
175177 continue
176- found = False
177- for y in scores :
178- if x .id == y [0 ] and (y [1 ] == self .h .convert (tactic .tactic .name ) or not y [1 ]):
179- x .score = y [2 ]
180- found = True
181- continue
182- if not found :
183- x .score = None
178+ self ._copy_scores ([x ], scores , tactic .tactic .name , exclude )
184179 if any (x .id == y [0 ] and (y [1 ] == self .h .convert (tactic .tactic .name ) or not y [1 ]) for y in subtechs ):
185180 a , offset = self .get_tech (offset , mode , x , tactic = self .h .convert (tactic .tactic .name ),
186181 subtechniques = tactic .subtechniques .get (x .id , []), colors = colors ,
@@ -286,4 +281,24 @@ def export(self, showName, showID, lhandle, config, sort=0, scores=[], colors=[]
286281 d .append (glob )
287282 if overlay :
288283 d .append (overlay )
289- return d
284+ return d
285+
286+
287+ def _copy_scores (self , listing , scores , tactic_name , exclude ):
288+ """
289+ INTERNAL: Move scores over from the input object (scores) to the one used to build the zvg (listing)
290+
291+ :param listing: List of objects to apply scores to
292+ :param scores: List of scores for this tactic
293+ :param exclude: List of excluded techniques
294+ :return: None - operates on the raw object itself
295+ """
296+ for b in listing :
297+ found = False
298+ for y in scores :
299+ if b .id == y [0 ] and (y [1 ] == self .h .convert (tactic_name ) or not y [1 ]):
300+ b .score = y [2 ]
301+ found = True
302+ continue
303+ if not found :
304+ b .score = None
0 commit comments