fedora-infra / anitya

A cross-distribution upstream release monitoring project
https://release-monitoring.org
GNU General Public License v2.0
250 stars 105 forks source link

Current backend is not pre-selected when editing a project #245

Closed ralphbean closed 8 years ago

ralphbean commented 8 years ago

Take this one for example. See the backend is PyPI? Click 'edit' and you'll see that "Bitbucket" is pre-selected in the form. If people don't pay attention and reset it to PyPI, that could lead to lots of misconfigured entries down the road.

We should update that form so that it has the current value you (PyPI) pre-selected.

ralphbean commented 8 years ago

OH.... I think this is because that entry has 'pypi' as its backend value in the DB... but only 'PyPI' is a valid value. Perhaps we need a db upgrade script to update old entries like this?

pypingou commented 8 years ago

iirc the backend used when searching the new version is case insensitive, so checking new version should work, only the drop-down is indeed not behaving as desired.

sudheesh001 commented 8 years ago

Has this issue been fixed, I've followed the following steps but was unable to reproduce the issue:

  1. Successful setup of anitya
  2. Logged in and clicked on Add project
  3. Added a pypi based project successfully and then clicked on edit I get the following screens with PyPi already selected.
screen shot 2016-02-17 at 12 05 18 pm screen shot 2016-02-17 at 12 05 28 pm

Is this still valid ? I believe its working fine. or have I gone wrong somewhere in the steps to reproduce this bug ?

pypingou commented 8 years ago

Yes it's still valid as it refers to project that were created with the old case. So if you create a project with a pypi backend that later got renamed to PyPI, then the workflow you have described won't work anymore and that's the source of the report here.

pypingou commented 8 years ago

I'm looking at the DB right now:

SELECT DISTINCT projects.backend FROM projects ORDER BY projects.backend;
    backend     
----------------
 BitBucket
 CPAN (perl)
 custom
 Debian project
 Drupal6
 Drupal7
 folder
 Freshmeat
 GitHub
 GNOME
 GNU project
 Google code
 Hackage
 Launchpad
 Maven Central
 npmjs
 pagure
 Pear
 PEAR
 PECL
 pypi
 PyPI
 Rubygems
 Sourceforge
 Stackage

So look at this I see two "problematic" backends: pypi and Pear.

pypingou commented 8 years ago

Some stats:

SELECT COUNT(projects.id) FROM projects WHERE projects.backend = 'pypi';
 count 
-------
   337
(1 row)

SELECT COUNT(projects.id) FROM projects WHERE projects.backend = 'PyPI';
 count 
-------
   307

SELECT COUNT(projects.id) FROM projects WHERE projects.backend = 'Pear';
 count 
-------
     8

SELECT COUNT(projects.id) FROM projects WHERE projects.backend = 'PEAR';
 count 
-------
     2
pypingou commented 8 years ago

Problem fixed:

UPDATE projects SET backend='PEAR' WHERE backend='Pear';
UPDATE 8

UPDATE projects SET backend='PyPI' WHERE backend='pypi';
UPDATE 337

:)