-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The billable invoice now subclasses the Invoice base class. The computations involved in preparation, namely filtering out nonbillable projects and PIs, and validating PI names, have been moved to `util.py`. The function for applying the New-PI credit (`apply_credits_new_pi`) is also moved there, and the I/O needed to read and write out the PI file has been moved out of this functions for ease of testing.
- Loading branch information
Showing
5 changed files
with
252 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from dataclasses import dataclass | ||
|
||
import process_report.invoices.invoice as invoice | ||
import process_report.util as util | ||
|
||
|
||
@dataclass | ||
class BillableInvoice(invoice.Invoice): | ||
nonbillable_pis: list[str] | ||
nonbillable_projects: list[str] | ||
old_pi_filepath: str | ||
|
||
def _prepare(self): | ||
self.data = util.remove_nonbillables( | ||
self.data, self.nonbillable_pis, self.nonbillable_projects | ||
) | ||
self.data = util.validate_pi_names(self.data) | ||
|
||
def _process(self): | ||
old_pi_df = util.load_old_pis(self.old_pi_filepath) | ||
self.data, updated_old_pi_df = util.apply_credits_new_pi(self.data, old_pi_df) | ||
util.dump_old_pis(self.old_pi_filepath, updated_old_pi_df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.