From b5e5f58b3a847c56b8e3b646733245d997e71456 Mon Sep 17 00:00:00 2001 From: Don Walizer <12420708+dwalizer@users.noreply.github.com> Date: Wed, 8 Jan 2025 09:34:16 -0500 Subject: [PATCH 1/4] #2948 Initial changes to exports --- .../userTranscript/UseTranscriptPdfExport.js | 15 ++++++++++----- .../skills/services/ExcelExportService.groovy | 12 ++++++++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/dashboard/src/skills-display/components/userTranscript/UseTranscriptPdfExport.js b/dashboard/src/skills-display/components/userTranscript/UseTranscriptPdfExport.js index 6bbef4c9f7..8f7578a048 100644 --- a/dashboard/src/skills-display/components/userTranscript/UseTranscriptPdfExport.js +++ b/dashboard/src/skills-display/components/userTranscript/UseTranscriptPdfExport.js @@ -238,7 +238,7 @@ export const useTranscriptPdfExport = () => { pdfHelper.addTitle(doc, overallStats, 'Progress Snapshot', 165) } - const addStat = (label, icon, x, num, totalNum = null) => { + const addStat = (label, icon, x, num, totalNum = null, endingText = null) => { const currentY = doc.y return doc.struct('Div', { title: `${label} stat` }, [ doc.struct('Span', { alt: `${label} stat icon` }, () => { @@ -247,18 +247,23 @@ export const useTranscriptPdfExport = () => { doc.struct('Span', () => { doc.text(`${label}: `, x + 20, currentY, { continued: true }) .fillColor(pdfHelper.arrowColor5).fontSize(13) - .text(`${numFormat.pretty(num)} `, { continued: totalNum !== null }) + .text(`${numFormat.pretty(num)} `, { continued: totalNum !== null || endingText !== null }) pdfHelper.resetTextStyle(doc) if (totalNum !== null) { - doc.text(`/ ${numFormat.pretty(totalNum)} `, {}) + doc.text(`/ ${numFormat.pretty(totalNum)} `, { continued: endingText !== null }) + } + if (endingText !== null) { + doc.text(`${endingText}`, {}) } }) ]) } overallStats.add(addStat(labelsConf.level, base64Images.trophy, 50, info.userLevel, info.totalLevels)) doc.moveUp() - overallStats.add(addStat(`${labelsConf.skill}s`, base64Images.arrowUp, 300, info.userSkillsCompleted, info.totalSkills)) - overallStats.add(addStat(`${labelsConf.point}s`, base64Images.hat, 50, info.userPoints, info.totalPoints)) + const skillsPercentage = ((info.userSkillsCompleted / info.totalSkills) * 100).toFixed(1) + const pointsPercentage = ((info.userPoints / info.totalPoints) * 100).toFixed(1) + overallStats.add(addStat(`${labelsConf.skill}s`, base64Images.arrowUp, 300, info.userSkillsCompleted, info.totalSkills, `(${skillsPercentage}%)`)) + overallStats.add(addStat(`${labelsConf.point}s`, base64Images.hat, 50, info.userPoints, info.totalPoints, `(${pointsPercentage}%)`)) if (info.achievedBadges && info.achievedBadges.length > 0) { doc.moveUp() overallStats.add(addStat(`${labelsConf.badge}s`, base64Images.badge, 300, info.achievedBadges.length)) diff --git a/service/src/main/java/skills/services/ExcelExportService.groovy b/service/src/main/java/skills/services/ExcelExportService.groovy index e723a7198e..c3a299b121 100644 --- a/service/src/main/java/skills/services/ExcelExportService.groovy +++ b/service/src/main/java/skills/services/ExcelExportService.groovy @@ -34,6 +34,7 @@ import skills.services.admin.skillReuse.SkillReuseIdUtil import skills.services.attributes.ExpirationAttrs import skills.storage.model.SkillDef import skills.storage.model.SkillRelDef +import skills.storage.repos.ProjDefRepo import skills.storage.repos.UserAchievedLevelRepo import skills.utils.InputSanitizer @@ -67,15 +68,18 @@ class ExcelExportService { @Autowired SkillsAdminService skillsAdminService + @Autowired + ProjDefRepo projDefRepo + @Transactional(readOnly = true) void exportUsersProgress(Workbook workbook, String projectId, String query, PageRequest pageRequest, int minimumPoints) { String projectExportHeaderAndFooter = userCommunityService.replaceProjectDescriptorVar(exportHeaderAndFooter, userCommunityService.getProjectUserCommunity(projectId)) Sheet sheet = workbook.createSheet() List headers if (userTagLabel) { - headers = ["User ID", "Last Name", "First Name", userTagLabel, "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"] + headers = ["User ID", "Last Name", "First Name", userTagLabel, "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"] } else { - headers = ["User ID", "Last Name", "First Name", "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"] + headers = ["User ID", "Last Name", "First Name", "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"] } Integer columnNumber = 0 Integer rowNum = initializeSheet(sheet, headers, projectExportHeaderAndFooter) @@ -84,6 +88,8 @@ class ExcelExportService { dateStyle.setDataFormat((short) 22) // NOTE: 14 = "mm/dd/yyyy" Cell cell = null + + Integer projectPoints = projDefRepo.getTotalPointsByProjectId(projectId) ?: 0 Stream projectUsers = adminUsersService.streamAllDistinctUsersForProject(projectId, query, pageRequest, minimumPoints) try { projectUsers.each { ProjectUser user -> @@ -97,6 +103,8 @@ class ExcelExportService { } row.createCell(columnNumber++).setCellValue(user.userMaxLevel) row.createCell(columnNumber++).setCellValue(user.totalPoints) + Double percentage = (user.totalPoints / projectPoints) * 100 + row.createCell(columnNumber++).setCellValue(percentage) cell = row.createCell(columnNumber++) cell.setCellStyle(dateStyle) From 8bfdd1560c93f20a1a1d5095fe5d98fe32d420f6 Mon Sep 17 00:00:00 2001 From: Don Walizer <12420708+dwalizer@users.noreply.github.com> Date: Thu, 9 Jan 2025 16:42:51 -0500 Subject: [PATCH 2/4] #2948 Update output of percentages, fix tests --- .../skills/services/ExcelExportService.groovy | 9 ++- .../export/ExportUserProgressSpec.groovy | 70 +++++++++---------- 2 files changed, 42 insertions(+), 37 deletions(-) diff --git a/service/src/main/java/skills/services/ExcelExportService.groovy b/service/src/main/java/skills/services/ExcelExportService.groovy index c3a299b121..9166fecb08 100644 --- a/service/src/main/java/skills/services/ExcelExportService.groovy +++ b/service/src/main/java/skills/services/ExcelExportService.groovy @@ -87,6 +87,9 @@ class ExcelExportService { CellStyle dateStyle = workbook.createCellStyle() dateStyle.setDataFormat((short) 22) // NOTE: 14 = "mm/dd/yyyy" + CellStyle percentStyle = workbook.createCellStyle() + percentStyle.setDataFormat((short) 9) + Cell cell = null Integer projectPoints = projDefRepo.getTotalPointsByProjectId(projectId) ?: 0 @@ -103,8 +106,10 @@ class ExcelExportService { } row.createCell(columnNumber++).setCellValue(user.userMaxLevel) row.createCell(columnNumber++).setCellValue(user.totalPoints) - Double percentage = (user.totalPoints / projectPoints) * 100 - row.createCell(columnNumber++).setCellValue(percentage) + Double percentage = (user.totalPoints / projectPoints) + cell = row.createCell(columnNumber++) + cell.setCellStyle(percentStyle) + cell.setCellValue(percentage) cell = row.createCell(columnNumber++) cell.setCellStyle(dateStyle) diff --git a/service/src/test/java/skills/intTests/export/ExportUserProgressSpec.groovy b/service/src/test/java/skills/intTests/export/ExportUserProgressSpec.groovy index 28bc7ab39e..eb0fba40ce 100644 --- a/service/src/test/java/skills/intTests/export/ExportUserProgressSpec.groovy +++ b/service/src/test/java/skills/intTests/export/ExportUserProgressSpec.groovy @@ -53,16 +53,16 @@ class ExportUserProgressSpec extends ExportBaseIntSpec { then: validateExport(excelExport.file, [ ["For All Dragons Only"], - ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"], - [getUserIdForDisplay(user2), getName(user2, false), getName(user2), "", "1.0", "60.0", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(user1), getName(user1, false), getName(user1), "", "2.0", "100.0", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"], + [getUserIdForDisplay(user2), getName(user2, false), getName(user2), "", "1.0", "60.0", "0.2", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(user1), getName(user1, false), getName(user1), "", "2.0", "100.0", "0.3333333333", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], ["For All Dragons Only"], ]) validateExport(excelExportAfterDelete.file, [ ["For All Dragons Only"], - ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"], - [getUserIdForDisplay(user2), getName(user2, false), getName(user2), "", "1.0", "10.0", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"], + [getUserIdForDisplay(user2), getName(user2, false), getName(user2), "", "1.0", "10.0", "0.2", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], ["For All Dragons Only"], ]) } @@ -120,13 +120,13 @@ class ExportUserProgressSpec extends ExportBaseIntSpec { then: validateExport(excelExport.file, [ ["For All Dragons Only"], - ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"], - [getUserIdForDisplay(users[0]), getName(users[0], false), getName(users[0]), "tag0", "0.0", "10.0", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[1]), getName(users[1], false), getName(users[1]), "tag1", "1.0", "20.0", oneDayAgo.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[2]), getName(users[2], false), getName(users[2]), "tag2", "1.0", "30.0", (oneDayAgo-1).format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[3]), getName(users[3], false), getName(users[3]), "tag3", "2.0", "50.0", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[4]), getName(users[4], false), getName(users[4]), "tag4", "3.0", "130.0", (tenDaysAgo+1).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[5]), getName(users[5], false), getName(users[5]), "tag5", "4.0", "140.0", (tenDaysAgo).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"], + [getUserIdForDisplay(users[0]), getName(users[0], false), getName(users[0]), "tag0", "0.0", "10.0", "0.05", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[1]), getName(users[1], false), getName(users[1]), "tag1", "1.0", "20.0", "0.1", oneDayAgo.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[2]), getName(users[2], false), getName(users[2]), "tag2", "1.0", "30.0", "0.15", (oneDayAgo-1).format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[3]), getName(users[3], false), getName(users[3]), "tag3", "2.0", "50.0", "0.25", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[4]), getName(users[4], false), getName(users[4]), "tag4", "3.0", "130.0", "0.65", (tenDaysAgo+1).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[5]), getName(users[5], false), getName(users[5]), "tag5", "4.0", "140.0", "0.7", (tenDaysAgo).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], ["For All Dragons Only"], ]) } @@ -159,9 +159,9 @@ class ExportUserProgressSpec extends ExportBaseIntSpec { then: validateExport(excelExport.file, [ ["For Divine Dragon Only"], - ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"], - [getUserIdForDisplay(user2), getName(user2, false), getName(user2), "", "1.0", "60.0", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(user1), getName(user1, false), getName(user1), "", "2.0", "100.0", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"], + [getUserIdForDisplay(user2), getName(user2, false), getName(user2), "", "1.0", "60.0", "0.2", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(user1), getName(user1, false), getName(user1), "", "2.0", "100.0", "0.3333333333", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], ["For Divine Dragon Only"], ]) } @@ -224,38 +224,38 @@ class ExportUserProgressSpec extends ExportBaseIntSpec { List> expectedDataForSortAsc = [ ["For All Dragons Only"], - ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"], - [getUserIdForDisplay(users[0]), getName(users[0], false), getName(users[0]), "tag00", "0.0", "10.0", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[1]), getName(users[1], false), getName(users[1]), "tag01", "1.0", "20.0", oneDayAgo.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[2]), getName(users[2], false), getName(users[2]), "tag02", "1.0", "30.0", (oneDayAgo-1).format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[3]), getName(users[3], false), getName(users[3]), "tag03", "2.0", "50.0", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[4]), getName(users[4], false), getName(users[4]), "tag04", "3.0", "130.0", (tenDaysAgo+1).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[5]), getName(users[5], false), getName(users[5]), "tag10", "4.0", "140.0", (tenDaysAgo).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"], + [getUserIdForDisplay(users[0]), getName(users[0], false), getName(users[0]), "tag00", "0.0", "10.0", "0.05", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[1]), getName(users[1], false), getName(users[1]), "tag01", "1.0", "20.0", "0.1", oneDayAgo.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[2]), getName(users[2], false), getName(users[2]), "tag02", "1.0", "30.0", "0.15", (oneDayAgo-1).format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[3]), getName(users[3], false), getName(users[3]), "tag03", "2.0", "50.0", "0.25", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[4]), getName(users[4], false), getName(users[4]), "tag04", "3.0", "130.0", "0.65", (tenDaysAgo+1).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[5]), getName(users[5], false), getName(users[5]), "tag10", "4.0", "140.0", "0.7", (tenDaysAgo).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], ["For All Dragons Only"], ] List> expectedDataForSortDesc = [ ["For All Dragons Only"], - ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"], - [getUserIdForDisplay(users[5]), getName(users[5], false), getName(users[5]), "tag10", "4.0", "140.0", (tenDaysAgo).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[4]), getName(users[4], false), getName(users[4]), "tag04", "3.0", "130.0", (tenDaysAgo+1).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[3]), getName(users[3], false), getName(users[3]), "tag03", "2.0", "50.0", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[2]), getName(users[2], false), getName(users[2]), "tag02", "1.0", "30.0", (oneDayAgo-1).format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[1]), getName(users[1], false), getName(users[1]), "tag01", "1.0", "20.0", oneDayAgo.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[0]), getName(users[0], false), getName(users[0]), "tag00", "0.0", "10.0", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"], + [getUserIdForDisplay(users[5]), getName(users[5], false), getName(users[5]), "tag10", "4.0", "140.0", "0.7", (tenDaysAgo).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[4]), getName(users[4], false), getName(users[4]), "tag04", "3.0", "130.0", "0.65", (tenDaysAgo+1).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[3]), getName(users[3], false), getName(users[3]), "tag03", "2.0", "50.0", "0.25", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[2]), getName(users[2], false), getName(users[2]), "tag02", "1.0", "30.0", "0.15", (oneDayAgo-1).format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[1]), getName(users[1], false), getName(users[1]), "tag01", "1.0", "20.0", "0.1", oneDayAgo.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[0]), getName(users[0], false), getName(users[0]), "tag00", "0.0", "10.0", "0.05", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], ["For All Dragons Only"], ] List> expectedDataForQuery = [ ["For All Dragons Only"], - ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"], - [getUserIdForDisplay(users[0]), getName(users[0], false), getName(users[0]), "tag00", "0.0", "10.0", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"], + [getUserIdForDisplay(users[0]), getName(users[0], false), getName(users[0]), "tag00", "0.0", "10.0", "0.05", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], ["For All Dragons Only"], ] List> expectedDataForMinPointsFilter = [ ["For All Dragons Only"], - ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"], - [getUserIdForDisplay(users[3]), getName(users[3], false), getName(users[3]), "tag03", "2.0", "50.0", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[4]), getName(users[4], false), getName(users[4]), "tag04", "3.0", "130.0", (tenDaysAgo+1).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], - [getUserIdForDisplay(users[5]), getName(users[5], false), getName(users[5]), "tag10", "4.0", "140.0", (tenDaysAgo).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"], + [getUserIdForDisplay(users[3]), getName(users[3], false), getName(users[3]), "tag03", "2.0", "50.0", "0.25", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[4]), getName(users[4], false), getName(users[4]), "tag04", "3.0", "130.0", "0.65", (tenDaysAgo+1).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + [getUserIdForDisplay(users[5]), getName(users[5], false), getName(users[5]), "tag10", "4.0", "140.0", "0.7", (tenDaysAgo).format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], ["For All Dragons Only"], ] From 03187aec6fd6636c1a4526d2afdfab8f6ae93556 Mon Sep 17 00:00:00 2001 From: Don Walizer <12420708+dwalizer@users.noreply.github.com> Date: Thu, 9 Jan 2025 17:06:30 -0500 Subject: [PATCH 3/4] #2948 Update test for progress percentage --- .../skills/intTests/export/ExportWithoutHeaderIT.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service/src/test/java/skills/intTests/export/ExportWithoutHeaderIT.groovy b/service/src/test/java/skills/intTests/export/ExportWithoutHeaderIT.groovy index 534d393830..246dad876e 100644 --- a/service/src/test/java/skills/intTests/export/ExportWithoutHeaderIT.groovy +++ b/service/src/test/java/skills/intTests/export/ExportWithoutHeaderIT.groovy @@ -63,9 +63,9 @@ class ExportWithoutHeaderIT extends ExportBaseIntSpec { then: validateExport(excelExport.file, [ - ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Points First Earned (UTC)", "Points Last Earned (UTC)"], - [getUserIdForDisplay(user2), getName(user2, false), getName(user2), "", "1.0", "60.0", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], - [getUserIdForDisplay(user1), getName(user1, false), getName(user1), "", "2.0", "100.0", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], + ["User ID", "Last Name", "First Name", "Org", "Level", "Current Points", "Percent Complete", "Points First Earned (UTC)", "Points Last Earned (UTC)"], + [getUserIdForDisplay(user2), getName(user2, false), getName(user2), "", "1.0", "60.0", "0.2", today.format("dd-MMM-yyyy"), today.format("dd-MMM-yyyy")], + [getUserIdForDisplay(user1), getName(user1, false), getName(user1), "", "2.0", "100.0", "0.3333333333", fiveDaysAgo.format("dd-MMM-yyyy"), oneDayAgo.format("dd-MMM-yyyy")], ]) } From 5e6659f7290d9543cd6e5171e7a8cf6210b9b777 Mon Sep 17 00:00:00 2001 From: Don Walizer <12420708+dwalizer@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:19:48 -0500 Subject: [PATCH 4/4] #2948 Update tests to include percentages --- .../skills-display-transcript-export_spec.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/e2e-tests/cypress/e2e/client-display/skills-display-transcript-export_spec.js b/e2e-tests/cypress/e2e/client-display/skills-display-transcript-export_spec.js index 3cc8dde9dd..4b2d5c54b8 100644 --- a/e2e-tests/cypress/e2e/client-display/skills-display-transcript-export_spec.js +++ b/e2e-tests/cypress/e2e/client-display/skills-display-transcript-export_spec.js @@ -112,8 +112,8 @@ describe('Transcript export tests', () => { expect(clean(doc.text)).to.include('SkillTree Transcript') expect(clean(doc.text)).to.include(projName) expect(clean(doc.text)).to.include('Level: 1 / 5 ') - expect(clean(doc.text)).to.include('Points: 100 / 600 ') - expect(clean(doc.text)).to.include('Skills: 0 / 3 ') + expect(clean(doc.text)).to.include('Points: 100 / 600 (16.7%)') + expect(clean(doc.text)).to.include('Skills: 0 / 3 (0.0%)') expect(clean(doc.text)).to.not.include('Badges') // should be a title on the 2nd page @@ -155,8 +155,8 @@ describe('Transcript export tests', () => { expect(clean(doc.text)).to.include('SkillTree Transcript') expect(clean(doc.text)).to.include(projName) expect(clean(doc.text)).to.include('Level: 1 / 5 ') - expect(clean(doc.text)).to.include('Points: 600 / 2,600 ') - expect(clean(doc.text)).to.include('Skills: 6 / 26 ') + expect(clean(doc.text)).to.include('Points: 600 / 2,600 (23.1%)') + expect(clean(doc.text)).to.include('Skills: 6 / 26 (23.1%)') expect(clean(doc.text)).to.not.include('Badges') // should be a title on the 2nd-4th pages @@ -204,8 +204,8 @@ describe('Transcript export tests', () => { expect(clean(doc.text)).to.include('SkillTree Transcript') expect(clean(doc.text)).to.include(projName) expect(clean(doc.text)).to.include('Level: 1 / 5 ') - expect(clean(doc.text)).to.include('Points: 600 / 2,600 ') - expect(clean(doc.text)).to.include('Skills: 6 / 26 ') + expect(clean(doc.text)).to.include('Points: 600 / 2,600 (23.1%)') + expect(clean(doc.text)).to.include('Skills: 6 / 26 (23.1%)') expect(clean(doc.text)).to.include('Badges: 1 ') // should be a title on the 2nd page @@ -403,8 +403,8 @@ describe('Transcript export tests', () => { expect(clean(doc.text)).to.include('SkillTree Transcript') expect(clean(doc.text)).to.include(projName) expect(clean(doc.text)).to.include('Level: 0 / 5 ') - expect(clean(doc.text)).to.include('Points: 600 / 21,000 ') - expect(clean(doc.text)).to.include('Skills: 6 / 210 ') + expect(clean(doc.text)).to.include('Points: 600 / 21,000 (2.9%)') + expect(clean(doc.text)).to.include('Skills: 6 / 210 (2.9%)') expect(clean(doc.text)).to.not.include('Badges ') // should be a title on the 2nd-4th pages @@ -607,8 +607,8 @@ describe('Transcript export tests', () => { expect(clean(doc.text)).to.include(user1) expect(clean(doc.text)).to.not.include(user2) expect(clean(doc.text)).to.include('Level: 1 / 5 ') - expect(clean(doc.text)).to.include('Points: 400 / 2,600 ') - expect(clean(doc.text)).to.include('Skills: 4 / 26 ') + expect(clean(doc.text)).to.include('Points: 400 / 2,600 (15.4%)') + expect(clean(doc.text)).to.include('Skills: 4 / 26 (15.4%)') expect(clean(doc.text)).to.not.include('Badges') }) @@ -624,8 +624,8 @@ describe('Transcript export tests', () => { expect(clean(doc.text)).to.include(user2) expect(clean(doc.text)).to.not.include(user1) expect(clean(doc.text)).to.include('Level: 0 / 5 ') - expect(clean(doc.text)).to.include('Points: 200 / 2,600 ') - expect(clean(doc.text)).to.include('Skills: 2 / 26 ') + expect(clean(doc.text)).to.include('Points: 200 / 2,600 (7.7%)') + expect(clean(doc.text)).to.include('Skills: 2 / 26 (7.7%)') expect(clean(doc.text)).to.not.include('Badges') }) @@ -691,7 +691,7 @@ describe('Transcript export tests', () => { cy.get('[data-cy="downloadTranscriptBtn"]').click() cy.readTranscript(projName).then((doc) => { - expect(clean(doc.text)).to.include('Skills: 2 / 4 ') + expect(clean(doc.text)).to.include('Skills: 2 / 4 (50.0%)') expect(clean(doc.text)).to.include('Achieved On') expect(clean(doc.text)).to.not.include('Approver') expect(clean(doc.text)).to.include(today) @@ -722,7 +722,7 @@ describe('Transcript export tests', () => { cy.get('[data-cy="downloadTranscriptBtn"]').click() cy.readTranscript(projName).then((doc) => { - expect(clean(doc.text)).to.include('Skills: 2 / 4 ') + expect(clean(doc.text)).to.include('Skills: 2 / 4 (50.0%)') expect(clean(doc.text)).to.include('Achieved On') expect(clean(doc.text)).to.include('Approver') expect(clean(doc.text)).to.include(today) @@ -752,7 +752,7 @@ describe('Transcript export tests', () => { cy.get('[data-cy="downloadTranscriptBtn"]').click() cy.readTranscript(projName).then((doc) => { - expect(clean(doc.text)).to.include('Skills: 0 / 4 ') + expect(clean(doc.text)).to.include('Skills: 0 / 4 (0.0%)') expect(clean(doc.text)).to.include('Achieved On') expect(clean(doc.text)).to.not.include('Approver') })