Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links in TODO lists are not updated when a package is moved between repositories #210

Open
FFY00 opened this issue Mar 23, 2019 · 1 comment
Labels

Comments

@FFY00
Copy link
Member

FFY00 commented Mar 23, 2019

When a package is moved from, lets say extra to community, if it is present in a TODO list, the package link is not updated there. This results in the TODO list linking to https://www.archlinux.org/packages/extra/x86_64/package/ instead of https://www.archlinux.org/packages/community/x86_64/package/.

@FFY00 FFY00 changed the title Links TODO lists are not updated when a package is moved between repositories Links in TODO lists are not updated when a package is moved between repositories Mar 23, 2019
@jelly jelly added the bug label Mar 24, 2019
@MrAnno
Copy link

MrAnno commented Apr 5, 2019

I might be mistaken, but it looks like the TodolistPackage model is not normalized, it contains redundancy:

models

The repo, pkgname and pkgbase attributes of TodolistPackage are copies of the corresponding TodolistPackage::pkg model's attributes. I guess these fields are there to make queries faster/easier, but they can go out of sync this way.

I've found other models that might have such problematic attributes, I've added them to the diagram.


I think a quick fix for the issue would be the following, but the root cause I mentioned could cause additional bugs (in case I'm not wrong about the normalization).

diff --git a/todolists/templatetags/todolists.py b/todolists/templatetags/todolists.py
index a54a9b8..b209228 100644
--- a/todolists/templatetags/todolists.py
+++ b/todolists/templatetags/todolists.py
@@ -14,7 +14,7 @@ def todopkg_details_link(todopkg):
     if not pkg:
         return todopkg.pkgname
     link = '<a href="%s" title="View package details for %s">%s</a>'
-    url = pkg_absolute_url(todopkg.repo, todopkg.arch, pkg.pkgname)
+    url = pkg_absolute_url(pkg.repo, pkg.arch, pkg.pkgname)
     return format_html(link % (url, pkg.pkgname, pkg.pkgname))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants