Skip to content

Commit

Permalink
Merge pull request #1581 from NationalSecurityAgency/t#1559/do_not_lo…
Browse files Browse the repository at this point in the history
…ad_last_reported_date

#1559: do not load lastReportedSkill date
  • Loading branch information
dwalizer authored Aug 19, 2022
2 parents 830c518 + 64f0d7c commit 8ed66d4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 0 additions & 2 deletions service/src/main/java/skills/storage/repos/ProjDefRepo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ interface ProjDefRepo extends CrudRepository<ProjDef, Long> {
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
Expand Down
19 changes: 19 additions & 0 deletions service/src/test/java/skills/intTests/AdminEditSpecs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8ed66d4

Please sign in to comment.