console: fix index 95th percentile (#2021)
Some checks failed
CI / 🤖 Check dependabot status (push) Has been cancelled
CI / 🐧 Test on Linux (${{ github.ref_type == 'tag' }}, misc) (push) Has been cancelled
CI / 🐧 Test on Linux (coverage) (push) Has been cancelled
CI / 🐧 Test on Linux (regular) (push) Has been cancelled
CI / ❄️ Build on Nix (push) Has been cancelled
CI / 🍏 Build and test on macOS (push) Has been cancelled
CI / 🧪 End-to-end testing (push) Has been cancelled
CI / 🔍 Upload code coverage (push) Has been cancelled
CI / 🔬 Test only Go (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 20) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 22) (push) Has been cancelled
CI / 🔬 Test only JS (${{ needs.dependabot.outputs.package-ecosystem }}, 24) (push) Has been cancelled
CI / ⚖️ Check licenses (push) Has been cancelled
CI / 🐋 Build Docker images (push) Has been cancelled
CI / 🐋 Tag Docker images (push) Has been cancelled
CI / 🚀 Publish release (push) Has been cancelled
Update Nix dependency hashes / Update dependency hashes (push) Has been cancelled

* fix index 95th percentile

* go fmt, update expected 95th percentile test results
This commit is contained in:
Gerhard Bogner
2025-10-13 18:43:53 +02:00
committed by GitHub
parent b207075339
commit 11749a17fb
2 changed files with 51 additions and 51 deletions

View File

@@ -427,7 +427,7 @@ func (c *Component) graphLineHandlerFunc(gc *gin.Context) {
// Max
output.Max[i] = points[nbPoints-1]
// 95th percentile with linear interpolation
index := 0.95*float64(nbPoints) - 1
index := 0.95 * float64(nbPoints-1)
j := int(index)
fraction := index - float64(j)
output.NinetyFivePercentile[i] = points[nbPoints-1]

View File

@@ -1002,12 +1002,12 @@ func TestGraphLineHandler(t *testing.T) {
700,
},
"95th": []int{
4700,
925,
1020,
935,
780,
1630,
4800,
950,
1080,
990,
820,
1720,
},
"axis": []int{
1, 1, 1, 1, 1, 1,
@@ -1128,19 +1128,19 @@ func TestGraphLineHandler(t *testing.T) {
70,
},
"95th": []int{
4700,
925,
1020,
935,
780,
1630,
4800,
950,
1080,
990,
820,
1720,
470,
93,
102,
94,
78,
163,
480,
96,
108,
100,
82,
172,
},
"axis": []int{
1, 1, 1, 1, 1, 1,
@@ -1228,13 +1228,13 @@ func TestGraphLineHandler(t *testing.T) {
6166,
},
"95th": []int{
4700,
925,
1020,
935,
780,
1630,
7700,
4800,
950,
1080,
990,
820,
1720,
7800,
},
"axis": []int{
1, 1, 1, 1, 1, 1,
@@ -1424,12 +1424,12 @@ func TestGraphLineHandler(t *testing.T) {
700,
},
"95th": []int{
4700,
1020,
935,
925,
780,
1630,
4800,
1080,
990,
950,
820,
1720,
},
"axis": []int{
1, 1, 1, 1, 1, 1,
@@ -1550,19 +1550,19 @@ func TestGraphLineHandler(t *testing.T) {
70,
},
"95th": []int{
4700,
1020,
935,
925,
780,
1630,
4800,
1080,
990,
950,
820,
1720,
470,
102,
94,
93,
78,
163,
480,
108,
100,
96,
82,
172,
},
"axis": []int{
1, 1, 1, 1, 1, 1,
@@ -1650,13 +1650,13 @@ func TestGraphLineHandler(t *testing.T) {
6166,
},
"95th": []int{
4700,
1020,
935,
925,
780,
1630,
7700,
4800,
1080,
990,
950,
820,
1720,
7800,
},
"axis": []int{
1, 1, 1, 1, 1, 1,