Skip to content

Commit

Permalink
#2517 - rename rejectionMsg to message
Browse files Browse the repository at this point in the history
  • Loading branch information
rmmayo committed Jan 9, 2025
1 parent 778e978 commit 3a66ff1
Show file tree
Hide file tree
Showing 14 changed files with 66 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ defineExpose( {
<div v-else><Badge variant="success"><i class="fas fa-thumbs-up"></i> <span class="text-uppercase">Approved</span></Badge></div>
<div class="text-primary">by</div>
<div class="font-italic"><span v-if="slotProps.data.approverUserIdHtml" v-html="slotProps.data.approverUserIdHtml"></span><span v-else>{{ slotProps.data.approverUserIdForDisplay }}</span></div>
<div v-if="slotProps.data.rejectionMsg"><span class="text-primary text-break">Explanation:</span> <show-more :text="slotProps.data.rejectionMsg"/></div>
<div v-if="slotProps.data.message"><span class="text-primary text-break">Explanation:</span> <show-more :text="slotProps.data.message"/></div>
</template>
</Column>
<Column field="requestedOn" sortable :class="{'flex': responsive.md.value }">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ const displayApprovalJustificationInput = () => {
}
const isPendingApproval = () => {
const res = skillInternal.value.selfReporting && skillInternal.value.selfReporting.requestedOn !== null && skillInternal.value.selfReporting.requestedOn !== undefined && !isRejected.value
return res
return skillInternal.value.selfReporting && skillInternal.value.selfReporting.requestedOn !== null && skillInternal.value.selfReporting.requestedOn !== undefined && !isRejected.value
}
const selfReportConfigured = () => {
return skillInternal.value.selfReporting && skillInternal.value.selfReporting && skillInternal.value.selfReporting.enabled
Expand Down Expand Up @@ -126,7 +125,7 @@ const reportSkill = (approvalRequestedMsg) => {
} else {
if (skillInternal.value.selfReporting) {
skillInternal.value.selfReporting.rejectedOn = null
skillInternal.value.selfReporting.rejectionMsg = null
skillInternal.value.selfReporting.message = null
}
selfReport.value.msgHidden = false
Expand Down Expand Up @@ -345,12 +344,12 @@ defineExpose({
<template #container>
<div class="flex p-3 align-content-center">
<div class="flex-1 align-content-center">
<i class="fas fa-heart-broken text-xl" aria-hidden=""></i>
<i class="fas fa-heart-broken text-xl" aria-hidden="true"></i>
Unfortunately your request from
<b>{{ timeUtils.formatDate(skillInternal.selfReporting.requestedOn, 'MM/DD/YYYY') }}</b> was rejected
<span
class="text-info">{{ timeUtils.relativeTime(skillInternal.selfReporting.rejectedOn) }}</span>.
<span v-if="skillInternal.selfReporting.rejectionMsg">The reason is: <b>"{{ skillInternal.selfReporting.rejectionMsg}}"</b></span>
<span v-if="skillInternal.selfReporting.message">The reason is: <b>"{{ skillInternal.selfReporting.rejectionMsg}}"</b></span>
</div>
<div class="">
<SkillsButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ class SkillApprovalResult {
String requestMsg

Long rejectedOn
String rejectionMsg
String message
Integer points
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class SkillApprovalService {
approverActionTakenOn: simpleSkillApproval.getApproverActionTakenOn()?.time,
rejectedOn: simpleSkillApproval.getRejectedOn()?.time,
requestMsg: simpleSkillApproval.getRequestMsg(),
rejectionMsg: simpleSkillApproval.getRejectionMsg(),
message: simpleSkillApproval.getMessage(),
points: simpleSkillApproval.getPoints(),
approverUserId: simpleSkillApproval.getApproverUserId(),
approverUserIdForDisplay: simpleSkillApproval.getApproverUserIdForDisplay(),
Expand Down Expand Up @@ -254,7 +254,7 @@ class SkillApprovalService {
validateProjId(it, projectId)

Date now = new Date()
it.rejectionMsg = rejectionMsg
it.message = rejectionMsg
it.rejectedOn = now
it.approverActionTakenOn = now
it.approverUserId = userInfoService.currentUser.username
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ApprovalHistoryLoader {
approverUserId: skillApproval.approverUserId,
approverUserIdForDisplay: skillApproval.approverUserIdForDisplay,
eventTime: skillApproval.rejectedOn?.time,
description: skillApproval.rejectionMsg,
description: skillApproval.message,
))
approvalHistory.add(new ApprovalEvent(
id: "${skillApproval.approvalId}-${index}",
Expand Down
4 changes: 2 additions & 2 deletions service/src/main/java/skills/skillLoading/SkillsLoader.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ class SkillsLoader {
justificationRequired: Boolean.valueOf(skillDef.justificationRequired),
requestedOn: skillApproval?.requestedOn?.time,
rejectedOn: !isFinished ? skillApproval?.rejectedOn?.time : null,
rejectionMsg: !isFinished ? skillApproval?.rejectionMsg : null,
message: !isFinished ? skillApproval?.message : null,
quizId: skillDefAndUserPoints?.quizId,
quizName: skillDefAndUserPoints?.quizName,
numQuizQuestions: skillDefAndUserPoints?.quizNumQuestions ?: 0,
Expand Down Expand Up @@ -782,7 +782,7 @@ class SkillsLoader {
justificationRequired: Boolean.valueOf(skillDef.justificationRequired),
requestedOn: skillApproval?.requestedOn?.time,
rejectedOn: skillApproval?.rejectedOn?.time,
rejectionMsg: skillApproval?.rejectionMsg,
message: skillApproval?.message,
quizId: quizNameAndId?.quizId,
quizName: quizNameAndId?.quizName,
numQuizQuestions: quizNameAndId?.configuredNumQuestionsQuizLength ?: (quizNameAndId?.numQuestions ?: 0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class SelfReportingInfo {
// only applicable to when selfReportingType == SelfReportingType.Approval
Long requestedOn
Long rejectedOn
String rejectionMsg
String message

// only applicable to when selfReportingType == SelfReportingType.Quiz
String quizId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package skills.storage.model

import jakarta.persistence.Column
import org.springframework.data.annotation.CreatedDate
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
Expand Down Expand Up @@ -50,7 +51,10 @@ class SkillApproval {
String requestMsg

Date rejectedOn
String rejectionMsg

@Column(name="rejection_msg")
String message

Date rejectionAcknowledgedOn

String approverUserId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ interface SkillApprovalRepo extends CrudRepository<SkillApproval, Integer> {
Date getApproverActionTakenOn()
String getRequestMsg()
Date getRejectedOn()
String getRejectionMsg()
String getMessage()
Integer getPoints()
}

Expand All @@ -60,7 +60,7 @@ interface SkillApprovalRepo extends CrudRepository<SkillApproval, Integer> {
s.approverActionTakenOn as approverActionTakenOn,
s.rejectedOn as rejectedOn,
s.requestMsg as requestMsg,
s.rejectionMsg as rejectionMsg,
s.message as message,
sd.pointIncrement as points
from SkillApproval s, SkillDef sd, UserAttrs uAttrs, SkillDef subjectDef, SkillRelDef srd
where
Expand All @@ -86,7 +86,7 @@ interface SkillApprovalRepo extends CrudRepository<SkillApproval, Integer> {
s.approverActionTakenOn as approverActionTakenOn,
s.rejectedOn as rejectedOn,
s.requestMsg as requestMsg,
s.rejectionMsg as rejectionMsg,
s.message as message,
sd.pointIncrement as points
from SkillApproval s, SkillDef sd, UserAttrs uAttrs, SkillDef subjectDef, SkillRelDef srd
where
Expand Down Expand Up @@ -163,7 +163,7 @@ interface SkillApprovalRepo extends CrudRepository<SkillApproval, Integer> {
s.approverActionTakenOn as approverActionTakenOn,
s.rejectedOn as rejectedOn,
s.requestMsg as requestMsg,
s.rejectionMsg as rejectionMsg,
s.message as message,
sd.pointIncrement as points
from SkillApproval s, SkillDef sd, UserAttrs uAttrs, SkillDef subjectDef, SkillRelDef srd
where
Expand Down Expand Up @@ -241,7 +241,7 @@ interface SkillApprovalRepo extends CrudRepository<SkillApproval, Integer> {
s.approverActionTakenOn as approverActionTakenOn,
s.rejectedOn as rejectedOn,
s.requestMsg as requestMsg,
s.rejectionMsg as rejectionMsg,
s.message as message,
sd.pointIncrement as points
from SkillApproval s, SkillDef sd, UserAttrs uAttrs, UserAttrs approverUAttrs, SkillDef subjectDef, SkillRelDef srd
where
Expand Down Expand Up @@ -328,7 +328,7 @@ interface SkillApprovalRepo extends CrudRepository<SkillApproval, Integer> {
s.approverActionTakenOn as approverActionTakenOn,
s.rejectedOn as rejectedOn,
s.requestMsg as requestMsg,
s.rejectionMsg as rejectionMsg
s.message as message
FROM SkillApproval s
JOIN UserAttrs uAttrs on uAttrs.userId = s.userId
LEFT OUTER JOIN UserAttrs approverUAttrs on approverUAttrs.userId = s.approverUserId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class SkillApprovalHistorySpecs extends DefaultIntSpec {
approvalsHistory2.data[0].requestMsg == "Please approve this 0!"
approvalsHistory2.data[0].approverActionTakenOn
!approvalsHistory2.data[0].rejectedOn
!approvalsHistory2.data[0].rejectionMsg
!approvalsHistory2.data[0].message
approvalsHistory2.data[0].approverUserId == skillsService.userName
approvalsHistory2.data[0].approverUserIdForDisplay == getUserIdForDisplay(skillsService.userName)

Expand All @@ -138,7 +138,7 @@ class SkillApprovalHistorySpecs extends DefaultIntSpec {
approvalsHistory2.data[1].requestMsg == "Please approve this 2!"
approvalsHistory2.data[1].approverActionTakenOn
!approvalsHistory2.data[1].rejectedOn
!approvalsHistory2.data[1].rejectionMsg
!approvalsHistory2.data[1].message
approvalsHistory2.data[1].approverUserId == skillsService.userName
approvalsHistory2.data[1].approverUserIdForDisplay == getUserIdForDisplay(skillsService.userName)

Expand All @@ -153,7 +153,7 @@ class SkillApprovalHistorySpecs extends DefaultIntSpec {
approvalsHistory2.data[2].requestMsg == "Please approve this 4!"
approvalsHistory2.data[2].approverActionTakenOn
approvalsHistory2.data[2].rejectedOn
approvalsHistory2.data[2].rejectionMsg == 'This is a rejection message'
approvalsHistory2.data[2].message == 'This is a rejection message'
approvalsHistory2.data[2].approverUserId == skillsService.userName
approvalsHistory2.data[2].approverUserIdForDisplay == getUserIdForDisplay(skillsService.userName)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class SkillApprovalSpecs extends DefaultIntSpec {
approvalsAfterRejection.size() == 1
approvalsAfterRejection.get(0).requestMsg == "Please approve this!"
approvalsAfterRejection.get(0).rejectedOn.format("yyyy-MM-dd") == new Date().format("yyyy-MM-dd")
approvalsAfterRejection.get(0).rejectionMsg == "Just felt like it"
approvalsAfterRejection.get(0).message == "Just felt like it"

approvalsAfterRejection.get(0).projectId == proj.projectId
approvalsAfterRejection.get(0).skillRefId == skillDefRepo.findAll().find({it.skillId == skills[0].skillId}).id
Expand Down Expand Up @@ -356,8 +356,8 @@ class SkillApprovalSpecs extends DefaultIntSpec {

List<SkillApproval> approvalsAfterRejection = skillApprovalRepo.findAll().sort { it.userId}
then:
approvalsAfterRejection.get(0).rejectionMsg == "Just felt like it"
!approvalsAfterRejection.get(1).rejectionMsg
approvalsAfterRejection.get(0).message == "Just felt like it"
!approvalsAfterRejection.get(1).message
}

void "ignore ids that do not exist during approval or rejection"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,50 +573,50 @@ class ClientDisplaySubjSummarySpec extends DefaultIntSpec {
res1.get(0).selfReporting.type == SkillDef.SelfReportingType.HonorSystem.toString()
!res1.get(0).selfReporting.requestedOn
!res1.get(0).selfReporting.rejectedOn
!res1.get(0).selfReporting.rejectionMsg
!res1.get(0).selfReporting.message

res1.get(1).skillId == proj1_subj1_skills[1].skillId
res1.get(1).selfReporting.enabled
res1.get(1).selfReporting.type == SkillDef.SelfReportingType.Approval.toString()
res1.get(1).selfReporting.requestedOn == date1.time
!res1.get(1).selfReporting.rejectedOn
!res1.get(1).selfReporting.rejectionMsg
!res1.get(1).selfReporting.message

res1.get(2).skillId == proj1_subj1_skills[2].skillId
!res1.get(2).selfReporting.enabled
!res1.get(2).selfReporting.type
!res1.get(2).selfReporting.requestedOn
!res1.get(2).selfReporting.rejectedOn
!res1.get(2).selfReporting.rejectionMsg
!res1.get(2).selfReporting.message

res1.get(3).skillId == proj1_subj1_skills[3].skillId
res1.get(3).selfReporting.enabled
res1.get(3).selfReporting.type == SkillDef.SelfReportingType.Approval.toString()
res1.get(3).selfReporting.requestedOn == date2.time
new Date(res1.get(3).selfReporting.rejectedOn).format('yyyy-MM-dd') == new Date().format('yyyy-MM-dd')
res1.get(3).selfReporting.rejectionMsg == "rejection message"
res1.get(3).selfReporting.message == "rejection message"

res2.size() == 3
res2.get(0).skillId == proj1_subj2_skills[0].skillId
!res2.get(0).selfReporting.enabled
!res2.get(0).selfReporting.type
!res2.get(0).selfReporting.requestedOn
!res2.get(0).selfReporting.rejectedOn
!res2.get(0).selfReporting.rejectionMsg
!res2.get(0).selfReporting.message

res2.get(1).skillId == proj1_subj2_skills[1].skillId
res2.get(1).selfReporting.enabled
res2.get(1).selfReporting.type == SkillDef.SelfReportingType.HonorSystem.toString()
!res2.get(1).selfReporting.requestedOn
!res2.get(1).selfReporting.rejectedOn
!res2.get(1).selfReporting.rejectionMsg
!res2.get(1).selfReporting.message

res2.get(2).skillId == proj1_subj2_skills[2].skillId
res2.get(2).selfReporting.enabled
res2.get(2).selfReporting.type == SkillDef.SelfReportingType.Approval.toString()
!res2.get(2).selfReporting.requestedOn
!res2.get(2).selfReporting.rejectedOn
!res2.get(2).selfReporting.rejectionMsg
!res2.get(2).selfReporting.message
}

def "when a self-reporting skill has a history of approvals only load the latest approval info - latest rejection"() {
Expand Down Expand Up @@ -669,28 +669,28 @@ class ClientDisplaySubjSummarySpec extends DefaultIntSpec {
res1.size() == 5
res1.get(0).skillId == skills[0].skillId
res1.get(0).selfReporting.enabled
res1.get(0).selfReporting.rejectionMsg == 'last rejection'
res1.get(0).selfReporting.message == 'last rejection'
res1.get(0).selfReporting.requestedOn == dates[0].time
res1.get(0).selfReporting.rejectedOn

res1.get(1).skillId == skills[1].skillId
res1.get(1).selfReporting.enabled
!res1.get(1).selfReporting.rejectionMsg
!res1.get(1).selfReporting.message
!res1.get(1).selfReporting.rejectedOn

res1.get(2).skillId == skills[2].skillId
res1.get(2).selfReporting.enabled
!res1.get(2).selfReporting.rejectionMsg
!res1.get(2).selfReporting.message
!res1.get(2).selfReporting.rejectedOn

res1.get(3).skillId == skills[3].skillId
res1.get(3).selfReporting.enabled
!res1.get(3).selfReporting.rejectionMsg
!res1.get(3).selfReporting.message
!res1.get(3).selfReporting.rejectedOn

res1.get(4).skillId == skills[4].skillId
res1.get(4).selfReporting.enabled
!res1.get(4).selfReporting.rejectionMsg
!res1.get(4).selfReporting.message
!res1.get(4).selfReporting.rejectedOn
}

Expand Down Expand Up @@ -735,26 +735,26 @@ class ClientDisplaySubjSummarySpec extends DefaultIntSpec {
res1.size() == 4
res1.get(0).skillId == skills[0].skillId
res1.get(0).selfReporting.enabled
!res1.get(0).selfReporting.rejectionMsg
!res1.get(0).selfReporting.message
res1.get(0).selfReporting.requestedOn == dates[0].time
!res1.get(0).selfReporting.rejectedOn

res1.get(1).skillId == skills[1].skillId
res1.get(1).selfReporting.enabled
!res1.get(1).selfReporting.rejectionMsg
!res1.get(1).selfReporting.message
!res1.get(1).selfReporting.rejectedOn
!res1.get(1).selfReporting.requestedOn


res1.get(2).skillId == skills[2].skillId
res1.get(2).selfReporting.enabled
!res1.get(2).selfReporting.rejectionMsg
!res1.get(2).selfReporting.message
!res1.get(2).selfReporting.rejectedOn
!res1.get(2).selfReporting.requestedOn

res1.get(3).skillId == skills[3].skillId
res1.get(3).selfReporting.enabled
!res1.get(3).selfReporting.rejectionMsg
!res1.get(3).selfReporting.message
!res1.get(3).selfReporting.rejectedOn
!res1.get(3).selfReporting.requestedOn
}
Expand Down Expand Up @@ -802,22 +802,22 @@ class ClientDisplaySubjSummarySpec extends DefaultIntSpec {
res1.size() == 4
res1.get(0).skillId == skills[0].skillId
res1.get(0).selfReporting.enabled
!res1.get(0).selfReporting.rejectionMsg
!res1.get(0).selfReporting.message
!res1.get(0).selfReporting.rejectedOn

res1.get(1).skillId == skills[1].skillId
res1.get(1).selfReporting.enabled
!res1.get(1).selfReporting.rejectionMsg
!res1.get(1).selfReporting.message
!res1.get(1).selfReporting.rejectedOn

res1.get(2).skillId == skills[2].skillId
res1.get(2).selfReporting.enabled
!res1.get(2).selfReporting.rejectionMsg
!res1.get(2).selfReporting.message
!res1.get(2).selfReporting.rejectedOn

res1.get(3).skillId == skills[3].skillId
res1.get(3).selfReporting.enabled
!res1.get(3).selfReporting.rejectionMsg
!res1.get(3).selfReporting.message
!res1.get(3).selfReporting.rejectedOn
}

Expand Down Expand Up @@ -866,11 +866,11 @@ class ClientDisplaySubjSummarySpec extends DefaultIntSpec {
assert it.selfReporting.requestedOn
assert it.selfReporting.rejectedOn
}
res1.collect { it.selfReporting.rejectionMsg } == ["reject skill1", "reject skill2", "reject skill3", "reject skill4"]
res1.collect { it.selfReporting.message } == ["reject skill1", "reject skill2", "reject skill3", "reject skill4"]

approvalsHistoryUser2.totalCount == 4
res2.size() == 4
res2.collect { it.selfReporting.rejectionMsg } == ["reject skill1", "reject skill2", "reject skill3", "reject skill4"]
res2.collect { it.selfReporting.message } == ["reject skill1", "reject skill2", "reject skill3", "reject skill4"]
res2.each {
assert it.selfReporting.enabled
}
Expand Down Expand Up @@ -921,7 +921,7 @@ class ClientDisplaySubjSummarySpec extends DefaultIntSpec {
res1.size() == 1
res1.get(0).skillId == skills[0].skillId
res1.get(0).selfReporting.enabled
!res1.get(0).selfReporting.rejectionMsg
!res1.get(0).selfReporting.message
!res1.get(0).selfReporting.rejectedOn
res1.get(0).selfReporting.requestedOn == dates[2].time
}
Expand Down
Loading

0 comments on commit 3a66ff1

Please sign in to comment.