Brown-University-Library / disa_dj_project

MIT License
2 stars 3 forks source link

unused db records being created with `null` values #203

Closed birkin closed 1 month ago

birkin commented 5 months ago

Noticed in tables 5_has_location and 4_citation_fields.

Hypothesis:

I'm going to focus on the backend validation and let front-end folk know what I find out.

birkin commented 5 months ago

DELETE note

8426|1790|23|1|0
8427|1790|748|4|1

...but after the sleep, and code, completes, the same query shows:

8426||23|1|0
8427||748|4|1

🤔

birkin commented 1 month ago

@prashleigh -- I think I know what's happening. The js api call is sending the webapp the new location info. I'm taking that location info, and getting the existing location-objects representing the state and town -- and then I'm ensuring all the update location-objects are attached to the existing reference.

The problem is that I'm never editing the -->pre-existing join record <--. The join-record has its OWN ID, and the reference and state and town ID fields. But because I'm not "UPDATING" a particular join record -- new location-objects are being attached to the reference.

I have to think about how to approach this.

prashleigh commented 1 month ago

What if the Django code first deleted the old locations before adding the new ones?

On Tue, May 7, 2024 at 5:24 PM Birkin James Diana @.***> wrote:

@prashleigh https://github.com/prashleigh -- I think I know what's happening. The js api call is sending the webapp the new location info. I'm taking that location info, and getting the existing location-objects representing the state and town -- and then I'm ensuring all the update location-objects are attached to the existing reference.

The problem is that I'm never editing the -->pre-existing join record <--. The join-record has its OWN ID, and the reference and state and town ID fields. But because I'm not "UPDATING" a particular join record -- new location-objects are being attached to the reference.

I have to think about how to approach this.

— Reply to this email directly, view it on GitHub https://github.com/Brown-University-Library/disa_dj_project/issues/203#issuecomment-2099334916, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABIX6EB56ISXOUGGDDYVX7LZBFBBJAVCNFSM6AAAAABCHT6X4GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJZGMZTIOJRGY . You are receiving this because you were mentioned.Message ID: @.*** com>

-- E. Patrick Rashleigh | Head of Digital Scholarship Technology Services Brown University Library | Center for Digital Scholarship 401.863.5076 | @.***

birkin commented 1 month ago