From 81fba897ccae57af451e4ea6283df196d7fb4ee5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Santanch=C3=A8?= Date: Thu, 11 Jan 2024 16:13:11 -0300 Subject: [PATCH] refactor (annotations/report): better json format --- .../public/report/js/report-annotations.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/adonisjs/public/report/js/report-annotations.js b/src/adonisjs/public/report/js/report-annotations.js index c662f1f9..dc113e79 100644 --- a/src/adonisjs/public/report/js/report-annotations.js +++ b/src/adonisjs/public/report/js/report-annotations.js @@ -365,15 +365,16 @@ class ReportManager { const annComp = [] for (const an of annotations) { - for (let f = 0; f < an.fragments.length; f++) { - annComp.push([ - an.fragments[f].fragment, - an.fragments[f].start, - an.fragments[f].start + an.fragments[f].size - 1, - (an.fragments.length == 1) ? 'U' : ((f == 0) ? 'B' : ((f+1 < an.fragments.length) ? 'I' : 'L')), - an.categories - ]) - } + let frag = '' + for (let f = 0; f < an.fragments.length; f++) + frag += (f > 0 ? ' + ' : '') + an.fragments[f].fragment + const last = an.fragments.length - 1 + annComp.push([ + frag, + an.fragments[0].start, + an.fragments[last].start + an.fragments[last].size - 1, + an.categories + ]) } return {