Remove / refactor TO class properties
This commit removes properties that weren't be used anywhere in the code base. It also refactors two properties to use sum() with a generator comprehension instead of a for loop.
This commit is contained in:
parent
aabedbcac4
commit
46ed1f0e71
@ -83,26 +83,10 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
||||
def is_active(self):
|
||||
return self.status == Status.ACTIVE
|
||||
|
||||
@property
|
||||
def is_upcoming(self):
|
||||
return self.status == Status.UPCOMING
|
||||
|
||||
@property
|
||||
def is_expired(self):
|
||||
return self.status == Status.EXPIRED
|
||||
|
||||
@property
|
||||
def is_unsigned(self):
|
||||
return self.status == Status.UNSIGNED
|
||||
|
||||
@property
|
||||
def has_begun(self):
|
||||
return self.start_date is not None and Clock.today() >= self.start_date
|
||||
|
||||
@property
|
||||
def has_ended(self):
|
||||
return self.start_date is not None and Clock.today() >= self.end_date
|
||||
|
||||
@property
|
||||
def clins_are_completed(self):
|
||||
return all([len(self.clins), (clin.is_completed for clin in self.clins)])
|
||||
@ -145,30 +129,13 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
||||
|
||||
@property
|
||||
def total_obligated_funds(self):
|
||||
total = 0
|
||||
for clin in self.clins:
|
||||
if clin.obligated_amount is not None:
|
||||
total += clin.obligated_amount
|
||||
return total
|
||||
return sum(
|
||||
(clin.obligated_amount for clin in self.clins if clin.obligated_amount)
|
||||
)
|
||||
|
||||
@property
|
||||
def total_contract_amount(self):
|
||||
total = 0
|
||||
for clin in self.clins:
|
||||
if clin.total_amount is not None:
|
||||
total += clin.total_amount
|
||||
return total
|
||||
|
||||
@property
|
||||
# TODO delete when we delete task_order_review flow
|
||||
def budget(self):
|
||||
return 100000
|
||||
|
||||
@property
|
||||
def balance(self):
|
||||
# TODO: fix task order -- reimplement using CLINs
|
||||
# Faked for display purposes
|
||||
return 50
|
||||
return sum((clin.total_amount for clin in self.clins if clin.total_amount))
|
||||
|
||||
@property
|
||||
def invoiced_funds(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user