readabilite: spread score to all ancestors
Instead of just parents and grandparentsmaster
parent
e3ab3c6823
commit
367f86987d
|
@ -88,13 +88,13 @@ def score_all(root):
|
||||||
|
|
||||||
grades[item] = score
|
grades[item] = score
|
||||||
|
|
||||||
parent = item.getparent()
|
factor = 2
|
||||||
if parent is not None:
|
for ancestor in item.iterancestors():
|
||||||
grades[parent] += score / 2.
|
if score / factor > 1:
|
||||||
|
grades[ancestor] += score / factor
|
||||||
gdparent = parent.getparent()
|
factor *= 2
|
||||||
if gdparent is not None:
|
else:
|
||||||
grades[gdparent] += score / 4.
|
break
|
||||||
|
|
||||||
return grades
|
return grades
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue