From bf13ccaa013296210014c3d6c896a136d46b51fc Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Thu, 5 May 2022 01:48:58 +0200 Subject: [PATCH] chore: commit save point --- ...nts_manager_and_run_requirement_report.xml | 2 +- application/source/requirements.go | 28 ++++++++++++++----- development/examples/example1/req1/1/test1.md | 2 +- development/examples/example1/req1/1/test2.md | 2 +- development/examples/example1/req1/1/test3.md | 2 +- development/examples/example1/req1/1/test4.md | 2 +- development/examples/example1/req1/2/test1.md | 2 +- development/examples/example1/req1/2/test2.md | 2 +- development/examples/example1/req1/2/test3.md | 2 +- development/examples/example1/req1/2/test4.md | 2 +- development/examples/example1/req1/2/test5.md | 2 +- development/examples/example1/req1/2/test6.md | 2 +- development/examples/example1/req1/3/test1.md | 2 +- development/examples/example1/req1/3/test2.md | 2 +- development/examples/example1/req1/3/test3.md | 2 +- development/examples/example1/req1/3/test4.md | 2 +- development/examples/example1/req1/3/test5.md | 2 +- development/examples/example1/req1/3/test6.md | 2 +- development/examples/example1/req1/3/test7.md | 2 +- development/examples/example1/req1/4/test1.md | 2 +- development/examples/example1/req1/4/test2.md | 2 +- development/examples/example1/req1/4/test3.md | 2 +- development/examples/example1/req1/4/test4.md | 2 +- development/examples/example1/req1/5/test1.md | 2 +- development/examples/example1/req1/5/test2.md | 2 +- development/examples/example1/req1/6/test1.md | 2 +- development/examples/example1/req1/6/test2.md | 2 +- 27 files changed, 47 insertions(+), 33 deletions(-) diff --git a/.idea/runConfigurations/go_build_requirements_manager_and_run_requirement_report.xml b/.idea/runConfigurations/go_build_requirements_manager_and_run_requirement_report.xml index 12237c5..0c93a80 100644 --- a/.idea/runConfigurations/go_build_requirements_manager_and_run_requirement_report.xml +++ b/.idea/runConfigurations/go_build_requirements_manager_and_run_requirement_report.xml @@ -2,7 +2,7 @@ <configuration default="false" name="go build requirements-manager and run requirement report" type="GoApplicationRunConfiguration" factoryName="Go Application"> <module name="requirements-manager" /> <working_directory value="$PROJECT_DIR$/application/source" /> - <parameters value="requirements report --grouped-by ID -p $PROJECT_DIR$/development/examples/example1" /> + <parameters value="requirements report --grouped-by Estimation -p $PROJECT_DIR$/development/examples/example1" /> <kind value="DIRECTORY" /> <package value="gitlab.schukai.com/oss/utilities/requirements-manager" /> <directory value="$PROJECT_DIR$/application/source" /> diff --git a/application/source/requirements.go b/application/source/requirements.go index 676e6ee..2119b00 100644 --- a/application/source/requirements.go +++ b/application/source/requirements.go @@ -169,8 +169,8 @@ func buildTimeReport(config *Configuration, arguments *commandLineOptions, pageM hasReport := false found := false - for t, p := range pageMap { - fmt.Println(t, p) + for _, p := range pageMap { + fields := reflect.VisibleFields(reflect.TypeOf(p)) for _, field := range fields { if field.Name == groupedByKey { @@ -202,7 +202,22 @@ func buildTable1(groupedByKey string, pageMap map[string]requirement) string { for _, d := range pageMap { r := reflect.ValueOf(d) - k := r.FieldByName(groupedByKey).String() + f := r.FieldByName(groupedByKey) + k := "" + switch f.Interface().(type) { + case bool: + k = strconv.FormatBool(r.FieldByName(groupedByKey).Bool()) + case int: + k = strconv.FormatInt(r.FieldByName(groupedByKey).Int(), 10) + case int64: + k = strconv.FormatInt(r.FieldByName(groupedByKey).Int(), 10) + case float64: + k = strconv.FormatFloat(r.FieldByName(groupedByKey).Float(), 'f', 10, 2) + case string: + k = r.FieldByName(groupedByKey).String() + default: + k = r.FieldByName(groupedByKey).String() + } s := float64(d.TimeSpent.Milliseconds()) / 1000 @@ -338,10 +353,7 @@ func buildTable2(pageMap map[string]requirement) string { for e, c := range est { - fmt.Println(e, c) - row := []string{} - row = append(row, fmt.Sprintf("%d", e)) row = append(row, time.Duration(c.time.sum*float64(time.Second)).String()) row = append(row, fmt.Sprintf("%.2f", c.time.average)) @@ -368,8 +380,10 @@ func printRequirementReport(config *Configuration, arguments *commandLineOptions err, table1, table2, _ := buildTimeReport(config, arguments, pageData) - report := "" + report := "## " + printer.Sprintf("Auflistung") + "\n\n" report += table1 + report += "\n" + report += "## " + printer.Sprintf("Statistics") + "\n\n" report += table2 fmt.Println(report) diff --git a/development/examples/example1/req1/1/test1.md b/development/examples/example1/req1/1/test1.md index d670d19..294156a 100644 --- a/development/examples/example1/req1/1/test1.md +++ b/development/examples/example1/req1/1/test1.md @@ -1,6 +1,6 @@ --- -ID: ID1 +ID: ID1-1 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/1/test2.md b/development/examples/example1/req1/1/test2.md index c0a035f..3b40198 100644 --- a/development/examples/example1/req1/1/test2.md +++ b/development/examples/example1/req1/1/test2.md @@ -1,6 +1,6 @@ --- -ID: ID2 +ID: ID1-2 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/1/test3.md b/development/examples/example1/req1/1/test3.md index a673b2d..5cf0860 100644 --- a/development/examples/example1/req1/1/test3.md +++ b/development/examples/example1/req1/1/test3.md @@ -1,6 +1,6 @@ --- -ID: ID3 +ID: ID1-3 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/1/test4.md b/development/examples/example1/req1/1/test4.md index b32c64e..d206d5a 100644 --- a/development/examples/example1/req1/1/test4.md +++ b/development/examples/example1/req1/1/test4.md @@ -1,6 +1,6 @@ --- -ID: ID4 +ID: ID1-4 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/2/test1.md b/development/examples/example1/req1/2/test1.md index 70d7973..a0a38f6 100644 --- a/development/examples/example1/req1/2/test1.md +++ b/development/examples/example1/req1/2/test1.md @@ -1,6 +1,6 @@ --- -ID: ID5 +ID: ID1-5 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/2/test2.md b/development/examples/example1/req1/2/test2.md index 142b509..bc5ae94 100644 --- a/development/examples/example1/req1/2/test2.md +++ b/development/examples/example1/req1/2/test2.md @@ -1,6 +1,6 @@ --- -ID: ID6 +ID: ID1-6 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/2/test3.md b/development/examples/example1/req1/2/test3.md index 925b905..5daaf15 100644 --- a/development/examples/example1/req1/2/test3.md +++ b/development/examples/example1/req1/2/test3.md @@ -1,6 +1,6 @@ --- -ID: ID7 +ID: ID1-7 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/2/test4.md b/development/examples/example1/req1/2/test4.md index 07c24ef..5f04a17 100644 --- a/development/examples/example1/req1/2/test4.md +++ b/development/examples/example1/req1/2/test4.md @@ -1,6 +1,6 @@ --- -ID: ID8 +ID: ID1-8 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/2/test5.md b/development/examples/example1/req1/2/test5.md index eec7807..5215225 100644 --- a/development/examples/example1/req1/2/test5.md +++ b/development/examples/example1/req1/2/test5.md @@ -1,6 +1,6 @@ --- -ID: ID9 +ID: ID1-9 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/2/test6.md b/development/examples/example1/req1/2/test6.md index 9863dcb..56222a8 100644 --- a/development/examples/example1/req1/2/test6.md +++ b/development/examples/example1/req1/2/test6.md @@ -1,6 +1,6 @@ --- -ID: ID10 +ID: ID1-10 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/3/test1.md b/development/examples/example1/req1/3/test1.md index 8b61077..d55bd99 100644 --- a/development/examples/example1/req1/3/test1.md +++ b/development/examples/example1/req1/3/test1.md @@ -1,6 +1,6 @@ --- -ID: ID11 +ID: ID1-11 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/3/test2.md b/development/examples/example1/req1/3/test2.md index 84b1909..94766fe 100644 --- a/development/examples/example1/req1/3/test2.md +++ b/development/examples/example1/req1/3/test2.md @@ -1,6 +1,6 @@ --- -ID: ID12 +ID: ID1-12 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/3/test3.md b/development/examples/example1/req1/3/test3.md index a61da67..efdc539 100644 --- a/development/examples/example1/req1/3/test3.md +++ b/development/examples/example1/req1/3/test3.md @@ -1,6 +1,6 @@ --- -ID: ID13 +ID: ID1-13 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/3/test4.md b/development/examples/example1/req1/3/test4.md index 3f80e07..2e22e63 100644 --- a/development/examples/example1/req1/3/test4.md +++ b/development/examples/example1/req1/3/test4.md @@ -1,6 +1,6 @@ --- -ID: ID14 +ID: ID1-14 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/3/test5.md b/development/examples/example1/req1/3/test5.md index 95d1c1b..3e49e98 100644 --- a/development/examples/example1/req1/3/test5.md +++ b/development/examples/example1/req1/3/test5.md @@ -1,6 +1,6 @@ --- -ID: ID15 +ID: ID1-15 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/3/test6.md b/development/examples/example1/req1/3/test6.md index 96cc07f..7e1af1d 100644 --- a/development/examples/example1/req1/3/test6.md +++ b/development/examples/example1/req1/3/test6.md @@ -1,6 +1,6 @@ --- -ID: ID16 +ID: ID1-16 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/3/test7.md b/development/examples/example1/req1/3/test7.md index e01062b..765583a 100644 --- a/development/examples/example1/req1/3/test7.md +++ b/development/examples/example1/req1/3/test7.md @@ -1,6 +1,6 @@ --- -ID: ID17 +ID: ID1-17 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/4/test1.md b/development/examples/example1/req1/4/test1.md index d31bfbe..ac1cabb 100644 --- a/development/examples/example1/req1/4/test1.md +++ b/development/examples/example1/req1/4/test1.md @@ -1,6 +1,6 @@ --- -ID: ID18 +ID: ID1-18 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/4/test2.md b/development/examples/example1/req1/4/test2.md index 1ac192b..209372d 100644 --- a/development/examples/example1/req1/4/test2.md +++ b/development/examples/example1/req1/4/test2.md @@ -1,6 +1,6 @@ --- -ID: ID19 +ID: ID1-19 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/4/test3.md b/development/examples/example1/req1/4/test3.md index 519a263..5151dde 100644 --- a/development/examples/example1/req1/4/test3.md +++ b/development/examples/example1/req1/4/test3.md @@ -1,6 +1,6 @@ --- -ID: ID20 +ID: ID1-20 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/4/test4.md b/development/examples/example1/req1/4/test4.md index 440d92b..11045bb 100644 --- a/development/examples/example1/req1/4/test4.md +++ b/development/examples/example1/req1/4/test4.md @@ -1,6 +1,6 @@ --- -ID: ID21 +ID: ID1-21 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/5/test1.md b/development/examples/example1/req1/5/test1.md index ee46ba3..3dc845f 100644 --- a/development/examples/example1/req1/5/test1.md +++ b/development/examples/example1/req1/5/test1.md @@ -1,6 +1,6 @@ --- -ID: ID22 +ID: ID1-22 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/5/test2.md b/development/examples/example1/req1/5/test2.md index 8260ba7..c31f84c 100644 --- a/development/examples/example1/req1/5/test2.md +++ b/development/examples/example1/req1/5/test2.md @@ -1,6 +1,6 @@ --- -ID: ID23 +ID: ID1-23 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/6/test1.md b/development/examples/example1/req1/6/test1.md index d95706c..1c24095 100644 --- a/development/examples/example1/req1/6/test1.md +++ b/development/examples/example1/req1/6/test1.md @@ -1,6 +1,6 @@ --- -ID: ID24 +ID: ID1-24 Title: null # Reference to other requirements diff --git a/development/examples/example1/req1/6/test2.md b/development/examples/example1/req1/6/test2.md index 8dac327..071b74c 100644 --- a/development/examples/example1/req1/6/test2.md +++ b/development/examples/example1/req1/6/test2.md @@ -1,6 +1,6 @@ --- -ID: ID25 +ID: ID1-25 Title: null # Reference to other requirements -- GitLab