Skip to content

Commit

Permalink
feat: Add warning when submitting a review for PoA and previous PoA i…
Browse files Browse the repository at this point in the history
…s not signed off yet.
  • Loading branch information
coire1 committed Jul 15, 2024
1 parent 8fd9f16 commit bb27baa
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<div class="content new-poa-review-popup">
<div class="box">
<h3>{{ $t('new_poa_review.title') }}</h3>
<o-notification v-if="!isPreviousPoaSignedOff" class="is-warning">
{{ $t('new_poa_review.no_previous_signoff') }}
</o-notification>
<schema-form
class="card-content scrollable-modal"
:schema="schema"
Expand Down Expand Up @@ -43,6 +46,10 @@ const props = defineProps({
som: {
type: Object,
default: () => {}
},
isPreviousPoaSignedOff: {
type: Boolean,
default: false
}
})
const emit = defineEmits(['poaReviewSubmitted'])
Expand Down
5 changes: 5 additions & 0 deletions milestone-tracker-frontend/src/components/poa/PoaList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<poa-single
class="current-poa"
:is-previous-poa-signed-off="isPreviousPoaSignedOff"
:current="true"
:poa="renderedPoas.current"
:som="som"
Expand Down Expand Up @@ -60,6 +61,10 @@ const props = defineProps({
submittablePoa: {
type: Boolean,
default: false
},
isPreviousPoaSignedOff: {
type: Boolean,
default: false
}
})
Expand Down
5 changes: 5 additions & 0 deletions milestone-tracker-frontend/src/components/poa/PoaSingle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
v-if="canWriteSomReview(proposal.id, proposal.challenge_id) && current && !locked && newReviewVisible"
class="section pr-0 pl-0">
<new-poa-review
:is-previous-poa-signed-off="isPreviousPoaSignedOff"
:som="som"
:poa="poa"
@poa-review-submitted="newReviewVisible = false"
Expand Down Expand Up @@ -114,6 +115,10 @@ const props = defineProps({
type: Object,
default: () => {}
},
isPreviousPoaSignedOff: {
type: Boolean,
default: false
}
})
import { useUser } from '@/store/user.js'
const { canWriteSomReview, canSignoff, canWithdrawSignoff } = useUser()
Expand Down
9 changes: 7 additions & 2 deletions milestone-tracker-frontend/src/components/som/SingleSom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@
</section>
<div v-if="som.poas.length > 0" class="columns">
<div :id="`poa-${som.milestone}`" class="column is-12">
<poa-list :som="som" :poas="som.poas" :proposal="proposal" :submittable-poa="current && canWriteSom(proposal.id) && (locked > 0) && !poaLocked" />
<poa-list
:is-previous-poa-signed-off="isPreviousPoaSignedOff(otherMilestonesSoms, som)"
:som="som"
:poas="som.poas"
:proposal="proposal"
:submittable-poa="current && canWriteSom(proposal.id) && (locked > 0) && !poaLocked" />
</div>
</div>
</div>
Expand Down Expand Up @@ -351,7 +356,7 @@ import NewSignoff from '@/components/forms/NewSignoff.vue'
import NewSignoffWithdraw from '@/components/forms/NewSignoffWithdraw.vue'
import SignoffWithdrawList from '@/components/shared/SignoffWithdrawList.vue'
import ResubmissionConfirm from '@/components/proposal/ResubmissionConfirm.vue'
import { canAllSomsBeSignedOffByReviews, isPreviousSomSignedOff } from '../../utils/milestones'
import { canAllSomsBeSignedOffByReviews, isPreviousSomSignedOff, isPreviousPoaSignedOff } from '../../utils/milestones'
</script>

<style lang="scss" scoped>
Expand Down
1 change: 1 addition & 0 deletions milestone-tracker-frontend/src/locales/messages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export default {
poa_approved_help: "Tick the checkbox if the Proof of Achievement for the Milestone is approved.",
comment: "Comment:",
comment_help: "Please provide a description why Proof of Achievement (PoA) is approved. In case PoA is not approved, please describe what is missing and how the proposer can amend them in order to get the approval.",
no_previous_signoff: "Previous milestone's PoA is not signed off yet. It is recommended to wait for its final approval before proceeding with the review of this PoA."
},
poa_reviews: {
open: "Open",
Expand Down
24 changes: 24 additions & 0 deletions milestone-tracker-frontend/src/utils/milestones.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,29 @@ const isPreviousSomSignedOff = (soms, currentSom) => {
return false
}

const isPreviousPoaSignedOff = (soms, currentSom) => {
if (currentSom) {
if (currentSom.milestone === 1) {
return true
}
const previousMl = soms.find((s) => {
if (s) {
return s.milestone === currentSom.milestone - 1
}
return false
})
if (previousMl) {
if (previousMl.poas.length > 0) {
const previousPoa = previousMl.poas.find((p) => p.current)
if (previousPoa) {
return previousPoa.signoffs.length > 0
}
}
}
}
return false
}


// Specific validation rules
const minCostF9 = () => 1
Expand Down Expand Up @@ -358,5 +381,6 @@ export {
canSubmitSomByChangeRequest,
canAllSomsBeSignedOffByReviews,
isPreviousSomSignedOff,
isPreviousPoaSignedOff,
generateValidationRules
}

0 comments on commit bb27baa

Please sign in to comment.