chicommons / maps

MIT License
6 stars 18 forks source link

BACKEND: Change Summary field for CoopProposal is incorrect. #240

Open maxgraziano opened 4 months ago

maxgraziano commented 4 months ago

Reported by @domdelorenzo, Verified by @maxgraziano

Environment: In development environment, using preloaded dataset.

Steps to reproduce: 1) Authenticate as admin user.

2) Create an UPDATE proposal record via POST to the /coops/proposal/create/ endpoint.

{
  "operation": "UPDATE",
  "coop_public_id" : 4,
  "coop": {
    "name": "TESTING"
  }
}

3) Confirm you get a 201 HTTP response. Response below.

{
  "id": 782,
  "requested_by": "chicommons",
  "proposal_status": "PENDING",
  "change_summary": "{\"coop_public_id\": 4, \"requested_by\": \"chicommons\", \"proposal_status\": \"PENDING\", \"operation\": \"UPDATE\", \"requested_datetime\": \"2024-05-15 15:05:33.756841+00:00\"}",
  "requested_datetime": "2024-05-15T10:05:33.756841-05:00",
  "coop": {
    "id": 780,
    "types": [
      {
        "name": "Housing Coop"
      }
    ],
    "contact_methods": [
      {
        "id": 1,
        "type": "PHONE",
        "is_public": true,
        "phone": "+13129437500",
        "email": null
      }
    ],
    "people": [],
    "addresses": [
      {
        "id": 6,
        "address": {
          "id": 6,
          "street_address": "1335 N ASTOR ST",
          "city": "Chicago",
          "county": "Cook County",
          "state": "IL",
          "postal_code": "60610",
          "country": "US",
          "latitude": 41.9069583,
          "longitude": -87.6271603
        },
        "is_public": true
      }
    ],
    "status": "PROPOSAL",
    "name": "TESTING",
    "web_site": "https://www.dkcondo.com/managed-associations/1335-astor-co-op/",
    "description": "",
    "is_public": true,
    "scope": "",
    "tags": "",
    "coop_public": 4
  },
  "review_notes": null,
  "reviewed_datetime": null,
  "coop_public": 4,
  "reviewed_by": null
}

Expected Behavior: The change_summary field should store the changes of the proposal. In other words, the "coop" field of the UPDATE proposal.

maxgraziano commented 4 months ago

Fix will only fix change_summary for newly created proposal. It will not got back and fix previously created change_summary.