OurchiveIO / ourchive

An easily installable fiction, audio, and image archive package.
GNU General Public License v3.0
7 stars 6 forks source link

AO3 import fails if user has a default_work_type set #141

Closed bellisk closed 2 months ago

bellisk commented 2 months ago

Describe the bug If a user has set a default work type, then attempting to import works from AO3 to their Ourchive account fails with this error: 'WorkType' object has no attribute 'first'. Without a default work type, the import succeeds.

To Reproduce

  1. Create a new Ourchive user
  2. Go to http://example.org/users/{USERNAME}/import and set up a new import from AO3
  3. After the import job has run, the user's AO3 works will be on their Ourchive account
  4. Delete one or more of the newly imported works
  5. Set a default work type for the user
  6. Set up a new import from AO3
  7. No works will be imported, and in the logs will be an error like this:
etl.ao3.work_import ERROR 2024-04-24 09:47:40,408 work_import 92900 140557348901632 Process work data failed for 54847861 in job fe4d0c01-e070-4088-9c66-cb6363806e4a: 'WorkType' object has no attribute 'first'.

Expected behavior The import from AO3 should work regardless of the user's default work type being set.

Desktop (please complete the following information):

Hosting Digital Ocean droplet running Ubuntu 22.04.

c-e-p commented 2 months ago

This is an issue that should be fixed, but apparently I need to take a second look at it.

edit: disregard this, I see your PR!