Updates to report functions.

This commit is contained in:
Landon Wark
2024-03-13 10:31:55 -05:00
parent 7cc9dd64c3
commit 2fd8a0b9b6
3 changed files with 21 additions and 4 deletions

View File

@@ -1,7 +1,6 @@
# __init__.py
from pathlib import Path
from tools import CustomFormatter
# Version of the realpython-reader package
__project__ = "submissions"
@@ -11,7 +10,16 @@ __copyright__ = "2022-2024, Government of Canada"
project_path = Path(__file__).parents[2].absolute()
bcolors = CustomFormatter.bcolors()
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
# Hello Landon, this is your past self here. I'm trying not to screw you over like I usually do, so I will
# set out the workflow I've imagined for creating new submission types.

View File

@@ -8,7 +8,7 @@ from PyQt6.QtCore import Qt, QAbstractTableModel, QSortFilterProxyModel
from PyQt6.QtGui import QAction, QCursor
from backend.db.models import BasicSubmission
from backend.excel import make_report_html, make_report_xlsx
from tools import Report, Result, row_map
from tools import Report, Result, row_map, get_first_blank_df_row
from xhtml2pdf import pisa
from .functions import select_save_file, select_open_file
from .misc import ReportDatePicker

View File

@@ -116,6 +116,15 @@ def check_regex_match(pattern:str, check:str) -> bool:
except TypeError:
return False
def get_first_blank_df_row(df:pd.DataFrame) -> int:
#First, find NaN entries in first column
# blank_row_bool = df.iloc[:,2].isna()
# logger.debug(f"Blank row bool: {blank_row_bool}")
# #Next, get index of first NaN entry
# blank_row_index = [i for i, x in enumerate(blank_row_bool) if x][0]
# return blank_row_index
return df.shape[0] + 1
# Settings
class Settings(BaseSettings):