benetech / Imageshare

MIT License
0 stars 0 forks source link

Missing Resource Files on import #213

Closed clapierre closed 4 years ago

clapierre commented 4 years ago

On the Dev environment: For some reason the following files are "missing" I can't find them when I search for them, they don't show up with the resource, however, when I re-import the resource I get the following:

File updated: Frog Dissection (print, texture, no labels)-extended File updated: Frog Dissection (print, grayscale, no labels)-simplified File updated: Frog Dissection (print, grayscale, labels)-simplified File updated: Frog Dissection (braille, no labels)-alt

I went through and deleted all "Frog Dissection" resource and resource files. Searching the resource files for "Frog dissection" after deleting them from the system and trash found 0 resources matching. However when I import the following JSON file the other 46 resources all behave correctly and says a new resource file has been associated with this resource. ie: File associated: Frog Dissection (print, color, labels) File associated: Frog Dissection (print, color, labels)-alt File associated: Frog Dissection (print, color, labels)-simplified

So the files: Frog Dissection (print, texture, no labels)-extended Frog Dissection (print, grayscale, no labels)-simplified Frog Dissection (print, grayscale, labels)-simplified Frog Dissection (braille, no labels)-alt

can not be found in the system, but the system thinks they exist, and they can't be added to the system it seems either since it thinks it is in the system already.

Here is the JSON file to import.(renamed to .txt for Github) FrogDissection.json.txt

clapierre commented 4 years ago

BTW, same behavior is happening on Staging.

jkva commented 4 years ago

I've seen this before, but rarely. I suspect it's a caching issue somewhere; will check.

jkva commented 4 years ago

@clapierre can you currently still reliably reproduce this?

clapierre commented 4 years ago

Yes I can with the Json file attached in this ticket. To dev and stagging

clapierre commented 4 years ago

With the latest code when I import the json file in this ticket I get what I expect on the Import results IE: alt=1 resource updated, 50 resource files updated

Screen Shot 2020-07-26 at 7 05 43 AM

However when I go to the Resource Files (Pending) it only shows 46 pending files as shown here: Screen Shot 2020-07-26 at 7 06 09 AM

and same for the Resource itself it when I go to the 1 Pending Resource I see that there is only 46 instead of 50 pending resource files. Screen Shot 2020-07-26 at 7 06 25 AM

jkva commented 4 years ago

@clapierre this one was quite difficult to debug! It turns out, some resource file URIs are repeating. And since I search by URI for uniqueness...

Anything we need to change there, or is this a bug in the JSON generation?

jkva commented 4 years ago

To clarify: the "updates" you're seeing are files that were just imported in that same session with the same URI

clapierre commented 4 years ago

I believe so but maybe the source of that resource changed from "Open Stax" to "Benetech" so maybe that has something to do with this so the unique identifier changed between imports. Maybe the only option is to completely dump the database and re-import everything again.

jkva commented 4 years ago

No, that would repeat the same thing. The issue is duplicate URIs. So whenever there are duplicate URIs you'll see "updates" while it's file A being created and file A being updated again within the same import session. I've added the post IDs that are created to the import results so you can confirm for yourself 👍

clapierre commented 4 years ago

My mistake, let me check maybe there is an issue with the excel spreadsheet.

clapierre commented 4 years ago

Ok yes I see a problem with the master Excel spreadsheet and duplicate URI's. So sorry about this. I will fix the Excel and re-create the JSON file and re-import it. I am marking this as closed now since I think that is the source of the problem.

clapierre commented 4 years ago

@jkva found all 4 duplicate URI's in the excel spreadsheet which was the cause of this issue.