mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat: archive git repository (experimental)
See doc/git-archive.md for general Git archive specifications See doc/repos/metadata-repo.md for info and direction related to the new Git metadata archive
This commit is contained in:
parent
ec3152014b
commit
30e72d2db5
34 changed files with 1104 additions and 50 deletions
|
@ -64,3 +64,13 @@ class PackageBase(Base):
|
|||
if key in PackageBase.TO_FLOAT and not isinstance(attr, float):
|
||||
return float(attr)
|
||||
return attr
|
||||
|
||||
|
||||
def popularity_decay(pkgbase: PackageBase, utcnow: int):
|
||||
"""Return the delta between now and the last time popularity was updated, in days"""
|
||||
return int((utcnow - pkgbase.PopularityUpdated.timestamp()) / 86400)
|
||||
|
||||
|
||||
def popularity(pkgbase: PackageBase, utcnow: int):
|
||||
"""Return up-to-date popularity"""
|
||||
return float(pkgbase.Popularity) * (0.98 ** popularity_decay(pkgbase, utcnow))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue