From 64f0d7c4b7a4c933c3d6d31655d32b89ca2de0af Mon Sep 17 00:00:00 2001 From: "EVOFORGE\\dimay" Date: Thu, 18 Aug 2022 21:50:13 -0400 Subject: [PATCH] #1559: do not load lastReportedSkill date --- .../skills/storage/repos/ProjDefRepo.groovy | 2 -- .../skills/intTests/AdminEditSpecs.groovy | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/service/src/main/java/skills/storage/repos/ProjDefRepo.groovy b/service/src/main/java/skills/storage/repos/ProjDefRepo.groovy index 8339667ca6..444863ac08 100644 --- a/service/src/main/java/skills/storage/repos/ProjDefRepo.groovy +++ b/service/src/main/java/skills/storage/repos/ProjDefRepo.groovy @@ -44,13 +44,11 @@ interface ProjDefRepo extends CrudRepository { COALESCE(groups.groupCount, 0) AS numGroups, CAST(COALESCE(expiration.expiringUnused, 'false') AS BOOLEAN) as expiring, expiration.expirationTriggeredDate as expirationTriggered, - events.latest AS lastReportedSkill, reusedSkills.skillCount AS numSkillsReused, reusedSkills.totalPoints AS totalPointsReused, pd.created, GREATEST(skills.skillUpdated, badges.badgeUpdated, subjects.subjectUpdated, pd.updated) as lastEdited FROM project_definition pd - LEFT JOIN (SELECT project_id, MAX(event_time) AS latest FROM user_events GROUP BY project_id) events ON events.project_id = pd.project_id LEFT JOIN (SELECT project_id, COUNT(id) AS errorCount FROM project_error GROUP BY project_id) errors ON errors.project_id = pd.project_id LEFT JOIN (SELECT project_id, COUNT(id) AS skillCount, MAX(updated) AS skillUpdated FROM skill_definition WHERE type = 'Skill' and skill_id not like '%STREUSESKILLST%' and enabled = 'true' GROUP BY project_id) skills ON skills.project_id = pd.project_id LEFT JOIN (SELECT project_id, COUNT(id) AS skillCount, SUM(total_points) AS totalPoints FROM skill_definition WHERE type = 'Skill' and skill_id like '%STREUSESKILLST%' and enabled = 'true' GROUP BY project_id) reusedSkills ON reusedSkills.project_id = pd.project_id diff --git a/service/src/test/java/skills/intTests/AdminEditSpecs.groovy b/service/src/test/java/skills/intTests/AdminEditSpecs.groovy index 6741c2b392..726db0fe94 100644 --- a/service/src/test/java/skills/intTests/AdminEditSpecs.groovy +++ b/service/src/test/java/skills/intTests/AdminEditSpecs.groovy @@ -527,6 +527,25 @@ class AdminEditSpecs extends DefaultIntSpec { e.message.contains "Each Project is limited to [25] Subjects" } + def "lastReportedSkill is not populated for get projects"() { + def proj1 = SkillsFactory.createProject(1) + def subj = SkillsFactory.createSubject(1, 1) + def skills = SkillsFactory.createSkills(2, 1, 1, 100, 2) + skillsService.createProjectAndSubjectAndSkills(proj1, subj, skills) + + skillsService.addSkill([projectId: proj1.projectId, skillId: skills[0].skillId]) + SkillsService rootUser = createRootSkillService() + rootUser.pinProject(proj1.projectId) + when: + def projectsForRoot = rootUser.getProjects() + def projectsRegUser = skillsService.getProjects() + + then: + projectsRegUser.lastReportedSkill == [null] + projectsForRoot.lastReportedSkill == [null] + } + + def "Badge creation limited per project"() { def proj1 = SkillsFactory.createProject(1) skillsService.createProject(proj1)