change function name
This commit is contained in:
parent
49356dfbbe
commit
da820c3500
2 changed files with 7 additions and 7 deletions
|
|
@ -2,7 +2,7 @@ from app import app, db
|
||||||
from flask import render_template, redirect, url_for, request, jsonify
|
from flask import render_template, redirect, url_for, request, jsonify
|
||||||
from sqlalchemy import select, delete, update
|
from sqlalchemy import select, delete, update
|
||||||
from .models import LineItem, BudgetCategory, Vendor
|
from .models import LineItem, BudgetCategory, Vendor
|
||||||
from .utils import get_uploads_path, get_month_timestamps, get_all_months
|
from .utils import get_bank_statements_path, get_month_timestamps, get_all_months
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
import openpyxl
|
import openpyxl
|
||||||
|
|
@ -34,15 +34,15 @@ def monthly_budget_summary():
|
||||||
@app.route('/line_items_by_month')
|
@app.route('/line_items_by_month')
|
||||||
def line_items_by_month():
|
def line_items_by_month():
|
||||||
all_months = get_all_months()
|
all_months = get_all_months()
|
||||||
files = os.listdir(get_uploads_path())
|
files = os.listdir(get_bank_statements_path())
|
||||||
return render_template('line_items_by_month.html',
|
return render_template('line_items_by_month.html',
|
||||||
files=files,
|
files=files,
|
||||||
all_months=all_months)
|
all_months=all_months)
|
||||||
|
|
||||||
@app.route('/upload_file/<filename>')
|
@app.route('/upload_file/<filename>')
|
||||||
def upload_file(filename:str):
|
def upload_file(filename:str):
|
||||||
file_path = get_uploads_path() + filename
|
bank_statement_file_path = get_bank_statements_path() + filename
|
||||||
xl = openpyxl.load_workbook(file_path, read_only=True)
|
xl = openpyxl.load_workbook(bank_statement_file_path, read_only=True)
|
||||||
wb = xl.worksheets[0]
|
wb = xl.worksheets[0]
|
||||||
|
|
||||||
items_to_add = []
|
items_to_add = []
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ def get_month_timestamps(month:int, year:int) -> tuple[float, float]:
|
||||||
last_day_timestamp = datetime.datetime(last_day_of_requested_month.year, last_day_of_requested_month.month, last_day_of_requested_month.day, 23, 59, 59).timestamp()
|
last_day_timestamp = datetime.datetime(last_day_of_requested_month.year, last_day_of_requested_month.month, last_day_of_requested_month.day, 23, 59, 59).timestamp()
|
||||||
return first_day_timestamp, last_day_timestamp
|
return first_day_timestamp, last_day_timestamp
|
||||||
|
|
||||||
def get_uploads_path() -> str:
|
def get_bank_statements_path() -> str:
|
||||||
path1 = 'C:/Users/Lenovo/Desktop/BudgetingApp/app/static/uploadable/'
|
path1 = 'C:/Users/Lenovo/Desktop/BudgetingApp/app/static/Bank_Statements/'
|
||||||
path2 = '/home/yisroel2/Desktop/budgetingApp/app/static/uploadable/'
|
path2 = '/home/yisroel2/Desktop/budgetingApp/app/static/Bank_Statements/'
|
||||||
for p in [path1, path2]:
|
for p in [path1, path2]:
|
||||||
if os.path.exists(p):
|
if os.path.exists(p):
|
||||||
path = p
|
path = p
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue