stats4sd / aec_portfolio

A proof of concept for the AEC Consortium Project Management / Assessment System
GNU General Public License v3.0
0 stars 0 forks source link

Check that history of changes is kept accurately #148

Closed dave-mills closed 1 year ago

dave-mills commented 1 year ago

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.

dave-mills commented 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.

dan-tang-ssd commented 1 year ago

I have created a new initiative for testing.


After assessing 13 red flags, 13 revisions records added as expected.

image

image


After assessing 13 principles, 13 revisions records added as expected.

image

image


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?

image

image

dan-tang-ssd commented 1 year ago

Performed two more testings.

  1. Assess Principles, change 9 / 13 principles to na. 18 revisions records added as expected. For each prinicple, one record for na, another record to change rating from original value 1.00 to NULL.

image

image


  1. Assess Red Flags, change one red flag from No to Yes, initative score changed to 0 as expected.

image

image

image

dave-mills commented 1 year ago

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.