Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #692 from egovernments/debasishchakraborty-egovt-p…
Browse files Browse the repository at this point in the history
…atch-2

Update app.py
  • Loading branch information
pradeepkumarcm-egov authored Jan 4, 2024
2 parents 1ab4529 + af38e1f commit 4f027da
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions utilities/rollout-dashboard-cronjob/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,36 +696,60 @@ def getdaterange(i):
lastepoch = enddate.strftime('%s') + '000'

if i == 'Quarter-1':
year = datetime.now().year
month = datetime.now().month
if(month < 4):
year = datetime.now().year-1
else:
year = datetime.now().year
start_date = datetime(year, 4, 1)
end_date = datetime(year, 6, 30)
end = datetime.combine(end_date,time.max)
epochnow = start_date.strftime('%s') + '000'
lastepoch = end.strftime('%s') + '000'

if i == 'Quarter-2':
year = datetime.now().year
month = datetime.now().month
if(month < 4):
year = datetime.now().year-1
else:
year = datetime.now().year
start_date = datetime(year, 7, 1)
end_date = datetime(year, 9, 30)
end = datetime.combine(end_date,time.max)
epochnow = start_date.strftime('%s') + '000'
lastepoch = end.strftime('%s') + '000'

if i == 'Quarter-3':
year = datetime.now().year
month = datetime.now().month
if(month < 4):
year = datetime.now().year-1
else:
year = datetime.now().year
start_date = datetime(year, 10, 1)
end_date = datetime(year, 12, 31)
end = datetime.combine(end_date,time.max)
epochnow = start_date.strftime('%s') + '000'
lastepoch = end.strftime('%s') + '000'

if i == 'Quarter-4':
year = datetime.now().year
start_date = datetime(year, 1, 1)
end_date = datetime(year, 3, 31)
end = datetime.combine(end_date,time.max)
epochnow = start_date.strftime('%s') + '000'
lastepoch = end.strftime('%s') + '000'

if i == 'FY to date':
today = datetime.now().year
start_date = datetime(today, 4, 1)
month = datetime.now().month
if(month < 4):
start_date = datetime(today-1, 4, 1)
else:
start_date = datetime(today, 4, 1)
epochnow = start_date.strftime('%s') + '000'
lastepoch = datetime.now().strftime('%s') + '000'

if i == 'Previous 1st FY (22-23)':
if i == 'Previous 1st FY (23-24)':
today = datetime.now().year
lastyear = today-1
start_date = datetime(lastyear, 4, 1)
Expand All @@ -734,7 +758,7 @@ def getdaterange(i):
epochnow = start_date.strftime('%s') + '000'
lastepoch = enddate.strftime('%s') + '000'

if i == 'Previous 2nd FY (21-22)':
if i == 'Previous 2nd FY (22-23)':
today = datetime.now().year
start_date = datetime(today-2, 4, 1)
end_date = datetime(today-1, 4, 1) + timedelta(days=-1)
Expand All @@ -743,7 +767,7 @@ def getdaterange(i):
lastepoch = enddate.strftime('%s') + '000'


if i == 'Previous 3rd FY (20-21)':
if i == 'Previous 3rd FY (21-22)':
today = datetime.now().year
start_date = datetime(today-3, 4, 1)
end_date = datetime(today-2, 4, 1) + timedelta(days=-1)
Expand Down Expand Up @@ -816,7 +840,7 @@ def process():
tenants = getGPWSCHeirarchy()
for tenant in tenants:
activeUsersCount= getActiveUsersCount(tenant['tenantId'])
daterange = ['Last seven days','Last 15 days','currentMonth-Till date','Previous Month','Quarter-1','Quarter-2','Quarter-3','Consolidated (As on date)','FY to date','Previous 1st FY (22-23)','Previous 2nd FY (21-22)','Previous 3rd FY (20-21)']
daterange = ['Last seven days','Last 15 days','currentMonth-Till date','Previous Month','Quarter-1','Quarter-2','Quarter-3','Quarter-4','Consolidated (As on date)','FY to date','Previous 1st FY (23-24)','Previous 2nd FY (22-23)','Previous 3rd FY (21-22)']
for i,date in enumerate(daterange):
startdate,enddate= getdaterange(date)
totalAdvance= getTotalAdvanceCreated(tenant['tenantId'],startdate,enddate)
Expand Down

0 comments on commit 4f027da

Please sign in to comment.