Closed dave-mills closed 1 year ago
At present, there is a "revisions" table, which is storing changes to PrincipleAssessment properties. We need to check:
In an ideal world, we should also keep track of the links between PrincipleAssessment + ScoreTag / CustomScoreTag and also AdditionalCriteriaAssessment + AdditionalCriteriaScoreTag / AdditionalCriteriaCustomScoreTag, but that is more complex and I think quite an edge case, so we can push this to a version 2.0 in favour of other issues.
We do need a way of presenting these changes via the UI to Institutional Admins and Site Managers/Admins. We should add a simple page with the full list of changes, (including the user who made the change, the date, the old and new values), and make it filterable by Initiative.
I have created a new initiative for testing.
After assessing 13 red flags, 13 revisions records added as expected.
After assessing 13 principles, 13 revisions records added as expected.
After assessing 1 additional criteria, 2 revisions records added. revisionable_id is same but revisionable_type are App\Models\AdditionalCriteriaAssessment and App\Models\PrincipleAssessment.
Question: Um... Why we have App\Models\PrincipleAssessment after assessing additional criteria?
Performed two more testings.
Question: Um... Why we have App\Models\PrincipleAssessment after assessing additional criteria?
Interesting find. I took a look at the save function on the PrincipleAssessmentModal Vue component, and found something that explains it:
async function save(nextAction) {
// ...stuff happens, and then:
await axios.patch(`/principle-assessment/${props.principleAssessment.id}`, props.principleAssessment)
let url = `/principle-assessment/${props.principleAssessment.id}`
// check if we are saving a principle-assessment or additional-criteria-assessment
if (props.assessmentType === "additional") {
url = `/additional-assessment/${props.principleAssessment.id}`
}
const res = await axios.patch(url, props.principleAssessment)
emit(nextAction)
}
The first axios.patch is probably the original, and then we swapped to the version where the url changes if it's an additional assessment. I expect at some point a merge occured that put both versions back together.
From the tech spec:
• Even after completion, the redline assessment can be edited by institutional members. – A history of changes is kept by the system, and is available to institutional managers for internal review purposes. – If at any point a redline entry is changed to be marked as “Yes”, the initiative’s score becomes 0, regardless of the answers given to the other stages of assessment.