openlibhums / openlibhums/janeway

Duplicate roles causes error when adding a new account

Open
#4,286 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug dev-ready Size XS
Dominant language
Python
Stars
239
Forks
97
Avg merge
9d 1h
Merged PRs (30d)
8

Description

This may just be a dev error, but here goes:

  • I was adding a new article via the submissions, using a superuser account and putting in a new/unknown author as the author rather than 'myself'. And I received the following error on submitting the third form in the process (not added the article itself yet).
  • [journal]/submit/13/authors/
Error Message

MultipleObjectsReturned at /submit/12/authors/

get() returned more than one Role -- it returned 2!
Request Method: | POST -- | -- http://localhost:8000/alpha/submit/12/authors/ 4.2.11 MultipleObjectsReturned get() returned more than one Role -- it returned 2! /Users/stephdriver/Documents/Janeway/venv/Janeway/lib/python3.9/site-packages/django/db/models/query.py, line 640, in get submission.decorators.submission_is_enabled_wrapper /Users/stephdriver/Documents/Janeway/venv/Janeway/bin/python3 3.9.19 ['/Users/stephdriver/Documents/Janeway/janeway/src', '/opt/homebrew/Cellar/python@3.9/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python39.zip', '/opt/homebrew/Cellar/python@3.9/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9', '/opt/homebrew/Cellar/python@3.9/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload', '/Users/stephdriver/Documents/Janeway/venv/Janeway/lib/python3.9/site-packages', '/Users/stephdriver/Documents/Janeway/janeway/src/plugins'] Thu, 20 Jun 2024 08:41:29 +0100
details

https://dpaste.com/F2N2BXV9K

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the POST to /submit/12/authors/ with an unknown author and read the Django traceback around the Role lookup. Inspect how the submission authors step handles duplicate Role records. Done means the reported submission flow no longer raises MultipleObjectsReturned; the issue does not specify the intended duplicate-handling behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.