Merge branch 'pending_salaries' of DigiFi/digifi-EventManager into master
This commit is contained in:
+12
-1
@@ -57,4 +57,15 @@ class Salary(db.Model):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
db.session.rollback()
|
db.session.rollback()
|
||||||
logger.info(f"error : {str(e)}")
|
logger.info(f"error : {str(e)}")
|
||||||
raise Exception(f"Error adding salary data: {str(e)}")
|
raise Exception(f"Error adding salary data: {str(e)}")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_pending_salaries(cls):
|
||||||
|
"""
|
||||||
|
Retrieve all salary entries with status 'START', ordered by ID ascending.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
return cls.query.filter_by(status='START').order_by(cls.id.asc()).all()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Error fetching pending salaries: {str(e)}")
|
||||||
|
return []
|
||||||
|
|||||||
@@ -131,6 +131,14 @@ def salary_detect():
|
|||||||
# PART 2 SELECT * FROM salaries WHERE status IS 'START' ORDER BY id ASC
|
# PART 2 SELECT * FROM salaries WHERE status IS 'START' ORDER BY id ASC
|
||||||
# **************************************************
|
# **************************************************
|
||||||
|
|
||||||
|
pending_salaries = SalaryService.get_pending_salaries()
|
||||||
|
|
||||||
|
if not pending_salaries:
|
||||||
|
logger.info(f"No pending salaries found")
|
||||||
|
# return ResponseHelper.success([], "No pending salaries found")
|
||||||
|
|
||||||
|
logger.info(f"Found {len(pending_salaries)} pending salaries")
|
||||||
|
|
||||||
#in the loop
|
#in the loop
|
||||||
# USE the customerID to find thu user Loan
|
# USE the customerID to find thu user Loan
|
||||||
# if loan is/are found for the user
|
# if loan is/are found for the user
|
||||||
|
|||||||
@@ -8,4 +8,11 @@ class SalaryService:
|
|||||||
"""
|
"""
|
||||||
Add a new salary data entry.
|
Add a new salary data entry.
|
||||||
"""
|
"""
|
||||||
return Salary.add_salary_data(data)
|
return Salary.add_salary_data(data)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_pending_salaries(cls):
|
||||||
|
"""
|
||||||
|
Get the pending salary for a given customer.
|
||||||
|
"""
|
||||||
|
return Salary.get_pending_salaries()
|
||||||
Reference in New Issue
Block a user