Browse Source

relative Pfadangaben

robert 10 months ago
parent
commit
334e811bdb

+ 2 - 1
requirements.txt

@@ -1,5 +1,6 @@
 beautifulsoup4
-Flask>=2.2.0
+chevron
+flask>=2.2.0
 flask_cors
 ldap3
 pandas

+ 2 - 2
webservice/csv_accounts.py

@@ -8,7 +8,7 @@ from pathlib import Path
 
 @plac.pos("period", "", type=str)
 def actuals(period):
-    base_dir = Path(__file__).absolute().parent.parent
+    base_dir = Path(__file__).parent.parent.resolve()
     print(base_dir)
     df1 = pd.read_csv(
         base_dir / "data/Belege_Planung_Ist_FC_AHR.csv", sep=";", decimal=",", dtype={0: str, 1: str, 2: str, 3: float}
@@ -60,7 +60,7 @@ def actuals(period):
 
 @plac.pos("year", "", type=str)
 def planning_prev(year):
-    base_dir = Path.cwd()  # .parent
+    base_dir = Path(__file__).parent.parent.resolve()
     print(base_dir)
     df1 = pd.read_csv(
         base_dir / f"data/Planner_{year}_V1_Plan.csv",

+ 1 - 2
webservice/gcstruct.py

@@ -641,8 +641,7 @@ class GCStruct:
 
 
 def gcstruct_uebersetzung():
-    # base_dir = 'P:/SKR51_GCStruct/'
-    base_dir = Path(".").absolute()
+    base_dir = Path(__file__).parent.parent.resolve()
     import_dir = base_dir
     if base_dir.name == "scripts":
         if base_dir.parent.parent.name == "Portal":

+ 3 - 3
webservice/hbv_export.py

@@ -9,8 +9,8 @@ from pathlib import Path
 current_year = "2023"
 current_version = "V1"
 
-base_dir = Path().cwd()
-config_dir = base_dir / "config/hbv"
+base_dir = Path(__file__).parent.parent.resolve()
+config_dir = base_dir / "config" / "hbv"
 export_dir = base_dir / "export"
 hb_format = config_dir / "hb_format.csv"
 hb_department = config_dir / "hb_department.csv"
@@ -18,7 +18,7 @@ hb_translation = config_dir / "hb_translation.csv"
 plan_amount = export_dir / f"Planner_{current_year}_{current_version}_Stk.csv"
 plan_values = export_dir / f"Planner_{current_year}_{current_version}_Plan.csv"
 
-hb_ignored = export_dir / "hbv/ignoriert.csv"
+hb_ignored = export_dir / "hbv" / "ignoriert.csv"
 
 current_date = datetime.now().strftime("%d%m%Y%H%M%S")
 # current_date = '24032021112656'

+ 1 - 1
webservice/marketing_plan.py

@@ -5,7 +5,7 @@ import json
 
 
 year = "2024"
-base_dir = Path(__file__).parent.parent
+base_dir = Path(__file__).parent.parent.resolve()
 filename = base_dir / "data" / f"Marketingplanung_AHR_{year}_V1.xls"
 output = base_dir / "export" / f"marketing_{year}.json"
 output_csv = base_dir / "export" / f"marketing_{year}.csv"

+ 4 - 1
webservice/plan_export.py

@@ -1,10 +1,11 @@
+from pathlib import Path
 from plan_values2 import VALUES2_HEADER
 
 import pandas as pd
 import numpy as np
 
 
-base_dir = "/home/robert/projekte/planner/export"
+base_dir = Path(__file__).parent.parent.resolve() / "export"
 
 id_header = ["Ebene" + str(i) for i in range(1, 11)]
 # values2_header = ['VJ', 'AJ', 'FC', 'Plan_ori', 'Plan_Prozent', 'Stk', 'VAK', 'BE_Prozent', 'Plan_VJ',
@@ -119,5 +120,7 @@ if __name__ == "__main__":
     # export_plan('V3', '2021', 'Stk')
     filename = "../save/2023_V1_20230214225753"
     filename = "../save/2024_V1_20240119104555"
+    filename = "../save/2024_V1_20240606161102"
+
     export_plan(filename, "V1", "2024", "Plan")
     export_plan(filename, "V1", "2024", "Stk")

+ 1 - 1
webservice/planner_combine_files.py

@@ -14,7 +14,7 @@ class PlannerCombineFiles:
         self.timestamp = timestamp
         self.username = username
 
-        self.base_dir = "save/"
+        self.base_dir = Path(__file__).parent.parent.resolve() / "save"
 
         self.file_list = [f.name for f in Path(self.base_dir).glob("*.*") if f.is_file()]
         self.file_list.sort()

+ 2 - 2
webservice/planner_load.py

@@ -228,6 +228,6 @@ class PlannerLoad:
 
 
 if __name__ == "__main__":
-    planner_dir = Path(__file__).parent.parent.joinpath("export")
+    planner_dir = Path(__file__).parent.parent.resolve() / "export"
     p_load = PlannerLoad(planner_dir)
-    print(p_load.convert_file(json.load(open(planner_dir.joinpath("2022_V1.json"), "r")))[12])
+    print(p_load.convert_file(json.load(open(planner_dir / "2022_V1.json", "r")))[12])