mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 03:12:27 +12:00
Use builtin sum function instead of manual increments
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
55b2e04bbf
commit
eac2964330
|
@ -201,18 +201,14 @@ class OutlineFolder(OutlineItem):
|
|||
counterKind = self.goalKind()
|
||||
|
||||
count = super().textCount(counterKind)
|
||||
|
||||
for item in self.items:
|
||||
count += item.textCount(counterKind)
|
||||
|
||||
count += sum(item.textCount(counterKind) for item in self.items)
|
||||
return count
|
||||
|
||||
def goalCount(self) -> int:
|
||||
count = super().goalCount()
|
||||
|
||||
if self.goal is None:
|
||||
for item in self.items:
|
||||
count += item.goalCount()
|
||||
count += sum(item.goalCount() for item in self.items)
|
||||
|
||||
return count
|
||||
|
||||
|
@ -280,11 +276,7 @@ class Outline:
|
|||
if counterKind is None:
|
||||
counterKind = self.goalKind()
|
||||
|
||||
count = 0
|
||||
for item in self.items:
|
||||
count += item.textCount(counterKind)
|
||||
|
||||
return count
|
||||
return sum(item.textCount(counterKind) for item in self.items)
|
||||
|
||||
def goalKind(self) -> CounterKind:
|
||||
if len(self.items) > 0:
|
||||
|
@ -293,11 +285,7 @@ class Outline:
|
|||
return CounterKind.WORDS
|
||||
|
||||
def goalCount(self) -> int:
|
||||
count = 0
|
||||
for item in self.items:
|
||||
count += item.goalCount()
|
||||
|
||||
return count
|
||||
return sum(item.goalCount() for item in self.items)
|
||||
|
||||
def load(self):
|
||||
self.items.clear()
|
||||
|
|
Loading…
Reference in a new issue