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):
|
def is_active(self):
|
||||||
return self.status == Status.ACTIVE
|
return self.status == Status.ACTIVE
|
||||||
|
|
||||||
@property
|
|
||||||
def is_upcoming(self):
|
|
||||||
return self.status == Status.UPCOMING
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_expired(self):
|
def is_expired(self):
|
||||||
return self.status == Status.EXPIRED
|
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
|
@property
|
||||||
def clins_are_completed(self):
|
def clins_are_completed(self):
|
||||||
return all([len(self.clins), (clin.is_completed for clin in self.clins)])
|
return all([len(self.clins), (clin.is_completed for clin in self.clins)])
|
||||||
@ -145,30 +129,13 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def total_obligated_funds(self):
|
def total_obligated_funds(self):
|
||||||
total = 0
|
return sum(
|
||||||
for clin in self.clins:
|
(clin.obligated_amount for clin in self.clins if clin.obligated_amount)
|
||||||
if clin.obligated_amount is not None:
|
)
|
||||||
total += clin.obligated_amount
|
|
||||||
return total
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def total_contract_amount(self):
|
def total_contract_amount(self):
|
||||||
total = 0
|
return sum((clin.total_amount for clin in self.clins if clin.total_amount))
|
||||||
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
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def invoiced_funds(self):
|
def invoiced_funds(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user