diff --git a/module/menuparser/.DS_Store b/module/menuparser/.DS_Store new file mode 100644 index 0000000..d1580a0 Binary files /dev/null and b/module/menuparser/.DS_Store differ diff --git "a/module/menuparser/Men\303\271 settimanale Cena.xls" "b/module/menuparser/Men\303\271 settimanale Cena.xls" new file mode 100644 index 0000000..96396f5 Binary files /dev/null and "b/module/menuparser/Men\303\271 settimanale Cena.xls" differ diff --git "a/module/menuparser/Men\303\271 settimanale pranzo.xls" "b/module/menuparser/Men\303\271 settimanale pranzo.xls" new file mode 100644 index 0000000..ff8594b Binary files /dev/null and "b/module/menuparser/Men\303\271 settimanale pranzo.xls" differ diff --git "a/module/menuparser/Men\303\271 settimanale pranzo.xlsx" "b/module/menuparser/Men\303\271 settimanale pranzo.xlsx" new file mode 100644 index 0000000..7bd9fe1 Binary files /dev/null and "b/module/menuparser/Men\303\271 settimanale pranzo.xlsx" differ diff --git a/module/menuparser/menu.py b/module/menuparser/menu.py new file mode 100644 index 0000000..41159f0 --- /dev/null +++ b/module/menuparser/menu.py @@ -0,0 +1,73 @@ +import openpyxl +from openpyxl import load_workbook + +#temporary way to acces the file necessary to extrapoalte the menù +MENU_PATH = 'Menù settimanale pranzo.xlsx' + +KEY_COLUMN = {1 : "B", 2 : "C" , 3 : "D" , 4 : "E", 5 : "F" , 6 : "G", 7 : "H"} + +#pass the menu of choice to open it +def open_menu(menu_name:str) -> openpyxl.worksheet.worksheet.Worksheet: + + menu_table = load_workbook(filename = menu_name) + menu_table = menu_table.active + + return menu_table + +#these functions returns the menu from the chosen day + +def extrapolate_menu(w_s: openpyxl.worksheet.worksheet.Worksheet, table_colum: int) -> list: + + menu_of_the_day = [] + table_char = KEY_COLUMN[table_colum] + + + for i in range (4, 15): + current_course = w_s[table_char + str(i)].value + menu_of_the_day.append(current_course) + + + + return menu_of_the_day + +def scroll_table(w_s , day:int) -> list: + match day: + + case 1: + menu_of_the_day = extrapolate_menu(w_s, day) + + case 2: + menu_of_the_day = extrapolate_menu(w_s, day) + + case 3: + menu_of_the_day = extrapolate_menu(w_s, day) + + case 4: + menu_of_the_day = extrapolate_menu(w_s, day) + + case 5: + menu_of_the_day = extrapolate_menu(w_s, day) + + case 6: + menu_of_the_day = extrapolate_menu(w_s, day) + + case 7: + menu_of_the_day = extrapolate_menu(w_s, day) + + case _: + return "ERROR the day selected doesn't exist" + + return menu_of_the_day + + + +def print_function(menu_list: list) -> None: + for menu_item in menu_list: + print(menu_item) + +if __name__ == "__main__": + + + table = open_menu(MENU_PATH) + menu = scroll_table(table, 1) + print_function(menu)