diff --git a/functions/calculation_rules.py b/functions/calculation_rules.py index 7fa73968992ed1e8fd4d11f16b1479b27f7ae074..7633378a7df56a9567f90008a96876f7ed536712 100644 --- a/functions/calculation_rules.py +++ b/functions/calculation_rules.py @@ -6,11 +6,15 @@ File consists of several functions for the calculation rules of FAIR Quality KPI def test_function(): print("You called the test function.") - +# Function to calculate KPIS that use sums +# Or function to calculate the mass with sum? def kpi_sum(*args): return sum(args[0]) # if arguments are handed over not as a list: sum(list(args)) +# KPI for calculating some real complicated metric + + if __name__ == "__main__": print( diff --git a/functions/classes.py b/functions/classes.py index 8e9a80354cca17dfca843cd0ad60c53f44e0e1ad..845ec8df67eba71ba2d70545dfe6470911909895 100644 --- a/functions/classes.py +++ b/functions/classes.py @@ -10,12 +10,16 @@ import json # TODO # - Docstrings -# - Beschreibung von Teilen (-> properties) -# - Gute String Darstellung -# - Minimalbeispiel für KPIs -# - Export als GraphViz -# - Erlaube Listen bei add_component und add_assembly ? -# - Zukunft: Erlaube Clone bei Assembly (jede Component muss durch Klon ersetzt werden) +# - Beschreibung von Teilen (-> properties) -> Raus aus dem Konstruktor rein in ein dict. (Deep-Copy) +# - Minimalbeispiel für KPIs -> halb umgesetzt -> mit get_components veranschaulichen +# - Erlaube Clone bei Assembly (jedes child muss durch durch Klon ersetzt werden) +# - Änderungen an Beispiel umsetzen + +# - Erlaube Listen bei add_component und add_assembly (-> Nä Semester) +# - Gute String Darstellung -> Ist so schon ok bisher? -> Nä Semester +# - Export als GraphViz -> Nä Semeseter + + class ComponentCategory(Enum): BATTERY = auto() diff --git a/test-classes.py b/test-classes.py index 0fbc4bee81165ba2b19eb4cf2522e16149c41eb0..dba41213a48759c7fb59690206f32658b9b92964 100644 --- a/test-classes.py +++ b/test-classes.py @@ -106,6 +106,8 @@ scooterwheel = LegoComponent("Vorderrad", ComponentCategory.WHEEL, TeuresRad["Designnummer"], TeuresRad["Preis [Euro]"], TeuresRad["Gewicht [g]"], 0) + +# TODO component with copy of dict from json # Cloning is necessary because each lego object gets a unique id so you can't use the same part twice scooterwheel2 = scooterwheel.clone() scooterwheel2.name = "Hinterrad" @@ -130,6 +132,9 @@ for c in scooter.components: for a in scooter.assemblies: # only checking one layer deep here listofmasses.append(a.mass) + +# TODO example with get_component_list + print(listofmasses) print(kpi_sum(listofmasses))