konveyor / tackle-pathfinder

Tackle Pathfinder application
Apache License 2.0
16 stars 23 forks source link

[TACKLE-9] Stakeholder and stakeholder group duplication #43

Closed mrizzi closed 3 years ago

mrizzi commented 3 years ago

While testing https://github.com/konveyor/tackle-ui/pull/136, I followed these steps (I tried to define the minimum set of steps to reproduce the issue):

  1. select an application (not assessed yet) and asses
  2. select one stakeholder and one stakeholder group
  3. Save as draft button => this executes PATCH with this (partially reported) JSON payload:
    {
      applicationId: 28
      id: 418
      questionnaire: {,…}
      stakeholderGroups: [149]
      stakeholders: [129]
      status: "STARTED"
    }
  4. Cancel button to go back to the application list
  5. select the same application and asses => this executes the GET call to the /pathfinder/assessments/418 endpoint had this (partially reported) JSON response:
    {
      applicationId: 28
      id: 418
      questionnaire: {,…}
      stakeholderGroups: [149]
      stakeholders: [129]
      status: "STARTED"
    }
  6. Save as draft button => this executes PATCH with this (partially reported) JSON payload:
    {
      applicationId: 28
      id: 418
      questionnaire: {,…}
      stakeholderGroups: [149]
      stakeholders: [129]
      status: "STARTED"
    }
  7. Cancel button to go back to the application list
  8. select the same application and asses => this executes the GET call to the /pathfinder/assessments/418 endpoint had this (partially reported) JSON response:
    {
      applicationId: 28
      id: 418
      questionnaire: {,…}
      stakeholderGroups: [149, 149]
      stakeholders: [129, 129]
      status: "STARTED"
    }

    and it seems like stakeholders and the stakeholderGroups doubled.

If I continue the Save as draft - Cancel loop, the stakeholders and the stakeholderGroups keep doubling every time.

It might be worth evaluating some DB constraints for ensuring unique (assessment_id, stakeholder_id) and (assessment_id, stakeholdergroup_id) non-deleted pairs.