Skip to content

Commit

Permalink
Adding changes to add inser rollout dashboard data to rolloutdashboar…
Browse files Browse the repository at this point in the history
…d legacy tablea
  • Loading branch information
debasishchakraborty-egovt committed Aug 12, 2024
1 parent 552e283 commit db54ef7
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions utilities/rollout-dashboard-cronjob/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,12 +808,11 @@ def createEntryForRollout(tenant,activeUsersCount,totalAdvance, totalPenalty,tot
if connection:
cursor.close()
connection.close()
def is_saturdayday():
print("DateTime today :",datetime.today().weekday())
return datetime.today().weekday() == 5

def is_saturdaydayOrSunday():
print("DateTime today :",datetime.today().weekday())
return datetime.today().weekday() in [5, 6]
def get_daterange():
if is_saturdayday():
if is_saturdaydayOrSunday():
return [
'Last seven days', 'Last 15 days', 'currentMonth-Till date', 'Previous Month',
'Quarter-1', 'Quarter-2', 'Quarter-3', 'Quarter-4',
Expand All @@ -831,15 +830,27 @@ def process():
cursor = connection.cursor()

print("cursor: ",cursor)

INSERT_INTO_ROLLOUT_LEGACY_QUERY=""" INSERT INTO roll_out_dashboardlegacy(
id, tenantid, tenantname, projectcode, zone, circle, division, subdivision, section, active_users_count,
total_advance, total_penalty, total_connections, active_connections, last_demand_gen_date,
demand_generated_consumer_count, total_demand_amount, collection_till_date, last_collection_date,
expense_count, count_of_electricity_expense_bills, no_of_paid_expense_bills, last_expense_txn_date,
total_amount_of_expense_bills, total_amount_of_electricity_bills, total_amount_of_paid_expense_bills,
date_range, createdtime) select id, tenantid, tenantname, projectcode, zone, circle, division, subdivision, section, active_users_count,
total_advance, total_penalty, total_connections, active_connections, last_demand_gen_date,
demand_generated_consumer_count, total_demand_amount, collection_till_date, last_collection_date,
expense_count, count_of_electricity_expense_bills, no_of_paid_expense_bills, last_expense_txn_date,
total_amount_of_expense_bills, total_amount_of_electricity_bills, total_amount_of_paid_expense_bills,
date_range, createdtime from roll_out_dashboard """
cursor.execute(INSERT_INTO_ROLLOUT_LEGACY_QUERY)
connection.commit()

DROPPING_TABLE_QUERY = " drop table if exists roll_out_dashboard "
cursor.execute(DROPPING_TABLE_QUERY)

connection.commit()

createTableQuery = createTable()
cursor.execute(createTableQuery)

connection.commit()

print("table dropped")
Expand Down

0 comments on commit db54ef7

Please sign in to comment.