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 12237c50e944fcb9f46e38ba5f26fd2ee27eb7db..0c93a80faa3fd57cd2802669069679b17ae88f9c 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 676e6eeab9f2141c95eb7cc6f9f5a42a2413a65b..2119b00096102b0c8545cad367bbd7b1d0a1f455 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 d670d1924c8e015f9afb34ad22500ede243ba2cd..294156a55f608d5a003dda927e756b55068ac23a 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 c0a035fbc62baa1e45e7a494a8b981762838de78..3b40198dff81eea31b7aaae1bcd96220629ca596 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 a673b2d0ff39f04ae8a015dc11f8f8ade09632fe..5cf0860638774acd00b1d353334e77cb79deea29 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 b32c64e50af740a0dfe5b59d13c0ae4819fe76f5..d206d5aecaf4ae17888b64620cbb1ea0ad6fcd85 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 70d7973869c345a72cb460881be4d93d96eaeaa2..a0a38f687dd1ace0220220e7aa63bd1cfa9e48ef 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 142b5097e9f8acd3d775b8daf90739aef8311148..bc5ae9494404884a9888a8f2c81b6f63431a0bf8 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 925b9051517eb789bcaa95ed45bd4c9cace4038b..5daaf15aee13b77b53f93e3c6f6abd588c176f5d 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 07c24ef357a1da3a5cf4a5d066fb6c42c01d3128..5f04a179d64eb7cd83cef9619b76c2e25c003165 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 eec78079da474e7813b25bf9f793f8e28a6cdb9b..52152251880d040e0c7e06b75ba131b69f46917c 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 9863dcbd069b40dbed2d65c50dcebaf085fb5cf9..56222a8bd331e8dfe5c9adf256a6868b495a7fbe 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 8b6107730dd0b3d677de961212305ec93cb88473..d55bd996df78c879ad40d14f1ccb4bdb99c31db7 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 84b1909c49a1656a80948c6aefba8a5b12089222..94766fea47525a2a3cb5262653a267e71a1d5ad8 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 a61da67c991844b4521e621887398dfbf7fb0235..efdc5398c4d9679fcb5a789c5fa16205b52f63a1 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 3f80e07dc85b3e6c5e2161c48a7686cfbf77d759..2e22e63039072e21fe9348da91c84ed63f03d230 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 95d1c1b5a5ccad821d38e23a71f8a0e229f31a69..3e49e985deceae4d32bdd026cb872b2f66b1d6c4 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 96cc07f2f235104ec6eabe7f086059f4d811429f..7e1af1d2df12b97855ef576ff234d6ad24db55f7 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 e01062bcbde95268f3c7238768b9c88a70ed3851..765583a711778d40488acd7df476511591fb2906 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 d31bfbe45dffb13d4ead37767d4009107d0629d4..ac1cabb3f33fadc81c923a12f3b81875fda58539 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 1ac192bf7eded8f783a219ffaa103e371fd28771..209372df7cd6e47817b2a0936cb23839248d472d 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 519a2635a1c776812b593eb62deca9f50c6f6cbd..5151ddee6a3e2d436beda503da57df1a5e9678e0 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 440d92bed4b0947efd0cc64052e3c67441bbf7f6..11045bb61fc3a523e36129a6ab76f1a015991758 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 ee46ba38288b30b9e24190dac0e49d0ca676c01d..3dc845fa2c6050970bfec1743a2078d29c240e1b 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 8260ba76b65eb3af416e0a209fb68efd52c6eb01..c31f84c5a99b8c73543d1984afd581f3a941c576 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 d95706cbdd5bf6735bd9d855b2dc1957c7cd488c..1c24095f1abf0c6d015b214886158f97abbed0b4 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 8dac327d1ba744c0d0adc40ab6936d81a340412c..071b74c03ed0d6b32dc7d505d5e48dcb236ee258 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