mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-13 13:12:42 +00:00
Fix beta versioning to be more generic test versioning
This allows us to specify both beta and rc versions. Requires SQL: ALTER TABLE core_version RENAME COLUMN beta TO testing; ALTER TABLE core_version ALTER COLUMN testing TYPE integer USING CASE WHEN testing THEN 2 ELSE 0 END;
This commit is contained in:
@ -9,14 +9,14 @@ def get_struct():
|
||||
# Can't use a model here, because we don't (for some reason) have a
|
||||
# hard link to the versions table here
|
||||
curs = connection.cursor()
|
||||
curs.execute("SELECT d.version, d.file, v.docsloaded, v.beta FROM docs d INNER JOIN core_version v ON v.tree=d.version ORDER BY d.version DESC")
|
||||
curs.execute("SELECT d.version, d.file, v.docsloaded, v.testing FROM docs d INNER JOIN core_version v ON v.tree=d.version ORDER BY d.version DESC")
|
||||
|
||||
# Start priority is higher than average but lower than what we assign
|
||||
# to the current version of the docs.
|
||||
docprio = 0.8
|
||||
lastversion = None
|
||||
|
||||
for version, filename, loaded, beta in curs.fetchall():
|
||||
for version, filename, loaded, testing in curs.fetchall():
|
||||
# Decrease the priority with 0.1 for every version of the docs
|
||||
# we move back in time, until we reach 0.1. At 0.1 it's unlikely
|
||||
# to show up in a general search, but still possible to reach
|
||||
@ -28,7 +28,7 @@ def get_struct():
|
||||
|
||||
yield ('docs/%s/static/%s' % (version==0 and 'devel' or version,
|
||||
filename),
|
||||
beta and 0.1 or docprio, # beta versions always get 0.1 in prio
|
||||
testing and 0.1 or docprio, # beta/rc versions always get 0.1 in prio
|
||||
loaded)
|
||||
|
||||
# Also yield the current version urls, with the highest
|
||||
|
@ -48,7 +48,7 @@ def docpage(request, version, typ, filename):
|
||||
page = get_object_or_404(DocPage, version=ver, file=fullname)
|
||||
versions = DocPage.objects.filter(file=fullname).extra(select={
|
||||
'supported':"COALESCE((SELECT supported FROM core_version v WHERE v.tree=version), 'f')",
|
||||
'beta':"CASE WHEN (SELECT beta FROM core_version v WHERE v.tree=version)='t' THEN true WHEN version=0 THEN true ELSE false END",
|
||||
'testing':"COALESCE((SELECT testing FROM core_version v WHERE v.tree=version),0)",
|
||||
}).order_by('-supported', '-version').only('version', 'file')
|
||||
|
||||
if typ=="interactive":
|
||||
@ -59,8 +59,8 @@ def docpage(request, version, typ, filename):
|
||||
return render_to_response('docs/docspage.html', {
|
||||
'page': page,
|
||||
'supported_versions': [v for v in versions if v.supported],
|
||||
'devel_versions': [v for v in versions if not v.supported and v.beta],
|
||||
'unsupported_versions': [v for v in versions if not v.supported and not v.beta],
|
||||
'devel_versions': [v for v in versions if not v.supported and v.testing],
|
||||
'unsupported_versions': [v for v in versions if not v.supported and not v.testing],
|
||||
'title': page.title,
|
||||
'doc_type': typ,
|
||||
'comments': comments,
|
||||
@ -76,7 +76,7 @@ def redirect_root(request, version):
|
||||
return HttpResponseRedirect("/docs/%s/static/" % version)
|
||||
|
||||
def root(request):
|
||||
versions = Version.objects.filter(Q(supported=True) | Q(beta=True,tree__gt=0)).order_by('-tree')
|
||||
versions = Version.objects.filter(Q(supported=True) | Q(testing__gt=0,tree__gt=0)).order_by('-tree')
|
||||
return render_to_response('docs/index.html', {
|
||||
'versions': versions,
|
||||
}, NavContext(request, 'docs'))
|
||||
@ -108,14 +108,14 @@ class _VersionPdfWrapper(Version):
|
||||
return 0
|
||||
|
||||
def manuals(request):
|
||||
# We don't include beta's here. Why?
|
||||
# We don't include beta/rc's here. Why?
|
||||
versions = Version.objects.filter(supported=True).order_by('-tree')
|
||||
return render_to_response('docs/manuals.html', {
|
||||
'versions': [_VersionPdfWrapper(v) for v in versions],
|
||||
}, NavContext(request, 'docs'))
|
||||
|
||||
def manualarchive(request):
|
||||
versions = Version.objects.filter(beta=False,supported=False,tree__gt=0).order_by('-tree')
|
||||
versions = Version.objects.filter(testing=0,supported=False,tree__gt=0).order_by('-tree')
|
||||
return render_to_response('docs/archive.html', {
|
||||
'versions': [_VersionPdfWrapper(v) for v in versions],
|
||||
}, NavContext(request, 'docs'))
|
||||
|
Reference in New Issue
Block a user