Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

20588 - Add verification logic in some .setters to avoid unnecessary db actions #1462

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions pay-api/src/pay_api/services/distribution_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ def service_fee_distribution_code_id(self):
@service_fee_distribution_code_id.setter
def service_fee_distribution_code_id(self, value: int):
"""Set the service_fee_distribution_code_id."""
self._service_fee_distribution_code_id = value
self._dao.service_fee_distribution_code_id = value
if self._service_fee_distribution_code_id != value:
self._service_fee_distribution_code_id = value
self._dao.service_fee_distribution_code_id = value

@property
def disbursement_distribution_code_id(self):
Expand All @@ -119,8 +120,9 @@ def disbursement_distribution_code_id(self):
@disbursement_distribution_code_id.setter
def disbursement_distribution_code_id(self, value: int):
"""Set the disbursement_distribution_code_id."""
self._disbursement_distribution_code_id = value
self._dao.disbursement_distribution_code_id = value
if self._disbursement_distribution_code_id != value:
self._disbursement_distribution_code_id = value
self._dao.disbursement_distribution_code_id = value

@property
def end_date(self):
Expand Down Expand Up @@ -152,8 +154,9 @@ def name(self):
@name.setter
def name(self, value: str):
"""Set the name."""
self._name = value
self._dao.name = value
if self._name != value:
self._name = value
self._dao.name = value

@property
def service_fee_stob(self):
Expand Down Expand Up @@ -247,8 +250,9 @@ def project_code(self):
@project_code.setter
def project_code(self, value: str):
"""Set the project_code."""
self._project_code = value
self._dao.project_code = value
if self._project_code != value:
self._project_code = value
self._dao.project_code = value

@property
def service_fee_client(self):
Expand All @@ -258,7 +262,8 @@ def service_fee_client(self):
@service_fee_client.setter
def service_fee_client(self, value: str):
"""Set the service_fee_client."""
self._service_fee_client = value
if self._service_fee_client != value:
self._service_fee_client = value

@property
def service_fee_project_code(self):
Expand All @@ -278,8 +283,9 @@ def stop_ejv(self):
@stop_ejv.setter
def stop_ejv(self, value: bool):
"""Set the stop_ejv."""
self._stop_ejv = value
self._dao.stop_ejv = value
if self._stop_ejv != value:
self._stop_ejv = value
self._dao.stop_ejv = value

@property
def account_id(self):
Expand All @@ -289,8 +295,9 @@ def account_id(self):
@account_id.setter
def account_id(self, value: int):
"""Set the account id."""
self._account_id = value
self._dao.account_id = value
if self._account_id != value:
self._account_id = value
self._dao.account_id = value

def save(self):
"""Save the distribution code information and commit."""
Expand Down
20 changes: 12 additions & 8 deletions pay-api/src/pay_api/services/eft_short_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ def auth_account_id(self):
@auth_account_id.setter
def auth_account_id(self, value: str):
"""Set the auth_account_id."""
self._auth_account_id = value
self._dao.auth_account_id = value
if self._auth_account_id != value:
self._auth_account_id = value
self._dao.auth_account_id = value

@property
def short_name(self):
Expand All @@ -117,8 +118,9 @@ def short_name(self):
@short_name.setter
def short_name(self, value: str):
"""Set the short name."""
self._short_name = value
self._dao.short_name = value
if self._short_name != value:
self._short_name = value
self._dao.short_name = value

@property
def created_on(self):
Expand All @@ -139,8 +141,9 @@ def linked_by(self):
@linked_by.setter
def linked_by(self, value: str):
"""Set the linked by user name."""
self._linked_by = value
self._dao.linked_by = value
if self._linked_by != value:
self._linked_by = value
self._dao.linked_by = value

@property
def linked_by_name(self):
Expand All @@ -150,8 +153,9 @@ def linked_by_name(self):
@linked_by_name.setter
def linked_by_name(self, value: str):
"""Set the linked by name."""
self._linked_by_name = value
self._dao.linked_by_name = value
if self._linked_by_name != value:
self._linked_by_name = value
self._dao.linked_by_name = value

@property
def linked_on(self):
Expand Down
25 changes: 15 additions & 10 deletions pay-api/src/pay_api/services/payment_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ def auth_account_id(self):
@auth_account_id.setter
def auth_account_id(self, value: str):
"""Set the auth_account_id."""
self._auth_account_id = value
self._dao.auth_account_id = value
if self._auth_account_id != value:
self._auth_account_id = value
self._dao.auth_account_id = value

@property
def name(self):
Expand All @@ -161,8 +162,9 @@ def name(self):
@name.setter
def name(self, value: str):
"""Set the name."""
self._name = value
self._dao.name = value
if self._name != value:
self._name = value
self._dao.name = value

@property
def payment_method(self):
Expand All @@ -172,8 +174,9 @@ def payment_method(self):
@payment_method.setter
def payment_method(self, value: int):
"""Set the payment_method."""
self._payment_method = value
self._dao.payment_method = value
if self._payment_method != value:
self._payment_method = value
self._dao.payment_method = value

@property
def cfs_account(self):
Expand Down Expand Up @@ -320,8 +323,9 @@ def billable(self):
@billable.setter
def billable(self, value: bool):
"""Set the billable."""
self._billable = value
self._dao.billable = value
if self._billable != value:
self._billable = value
self._dao.billable = value

@property
def eft_enable(self):
Expand All @@ -331,8 +335,9 @@ def eft_enable(self):
@eft_enable.setter
def eft_enable(self, value: bool):
"""Set the eft_enable."""
self._eft_enable = value
self._dao.eft_enable = value
if self._eft_enable != value:
self._eft_enable = value
self._dao.eft_enable = value

def save(self):
"""Save the information to the DB."""
Expand Down
Loading