Package: nm.debian.org
Severity: important

We now have a case of a person who wants to retire upon receiving a WAT
ping, but who already received and turned down a previos WAT ping.

This causes a 500 error trying to follow the tokenized url:

    Internal Server Error: /process/emeritus

    MultipleObjectsReturned at /process/emeritus
    get() returned more than one Process -- it returned 2!

    File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py" in 
inner
      42.             response = get_response(request)
    File "/usr/lib/python3/dist-packages/django/core/handlers/base.py" in 
_legacy_get_response
      249.             response = self._get_response(request)
    File "/usr/lib/python3/dist-packages/django/core/handlers/base.py" in 
_get_response
      187.                 response = self.process_exception_by_middleware(e, 
request)
    File "/usr/lib/python3/dist-packages/django/core/handlers/base.py" in 
_get_response
      185.                 response = wrapped_callback(request, *callback_args, 
**callback_kwargs)
    File "/usr/lib/python3/dist-packages/django/views/generic/base.py" in view
      68.             return self.dispatch(request, *args, **kwargs)
    File "/srv/nm.debian.org/nm2/backend/mixins.py" in dispatch
      66.             self.load_objects()
    File "/srv/nm.debian.org/nm2/process/views.py" in load_objects
      753.                 const.STATUS_EMERITUS_DD, const.STATUS_REMOVED_DD))
    File "/usr/lib/python3/dist-packages/django/db/models/manager.py" in 
manager_method
      85.                 return getattr(self.get_queryset(), name)(*args, 
**kwargs)
    File "/usr/lib/python3/dist-packages/django/db/models/query.py" in get
      389.             (self.model._meta.object_name, num)

Now, the issue is due to this query in process/views.py:

        try:
            self.process = pmodels.Process.objects.get(person=self.person, 
applying_for__in=(
                const.STATUS_EMERITUS_DD, const.STATUS_REMOVED_DD))
        except pmodels.Process.DoesNotExist:
            self.process = None

I tried to change that to filter out closed processes, but now I
understand that's not correct: the presence of a closed process is
considered as a sign that the process has already been processed and
therefore the applicant can't retire that way anymore.

It's unclear to me how it should behave in this situation:
 * the presence of an open process for dd_e/dd_r definitely means the
   applicant should be able to follow the one-click-emeritus url
 * the presence of one closed process doesn't necassarily mean the
   person is "too late": the closed process might be from an old
   process that is already long over and doens't matter anymore
 * but how to distiguish the previous case from a current dd_r process
   that has already been approved (besides, approved but not closed
   processes are not filtered currently, they probably should) and so
   the applicant can't do anything anymore?

-- 
regards,
                        Mattia Rizzolo

GPG Key: 66AE 2B4A FCCF 3F52 DA18  4D18 4B04 3FCD B944 4540      .''`.
more about me:  https://mapreri.org                             : :'  :
Launchpad user: https://launchpad.net/~mapreri                  `. `'`
Debian QA page: https://qa.debian.org/developer.php?login=mattia  `-

Attachment: signature.asc
Description: PGP signature

Reply via email to