summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2016-05-31 20:57:26 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2016-05-31 20:57:26 +0100
commit96383c37d0652cad9b87421a43cb28dcd2974bf0 (patch)
tree18cfc7d0cee22831986c8abe1913073526a729c1
parentRemove debug and bind correct fields of bug data (diff)
downloadgentoobrowse-api-96383c37d0652cad9b87421a43cb28dcd2974bf0.tar.bz2
gentoobrowse-api-96383c37d0652cad9b87421a43cb28dcd2974bf0.tar.xz
gentoobrowse-api-96383c37d0652cad9b87421a43cb28dcd2974bf0.zip
Don't require processOrder on file types
-rw-r--r--gentoobrowse-api/db/schema.sql3
-rw-r--r--gentoobrowse-api/service/maintenancePackageTree.cpp6
-rw-r--r--gentoobrowse-api/service/sql/maintenance/fileListCreate.sql1
-rw-r--r--gentoobrowse-api/unittests/basedata.sql2
-rw-r--r--gentoobrowse-api/unittests/data.sql2
-rw-r--r--gentoobrowse-api/unittests/fixtures/filetypes.dat22
6 files changed, 19 insertions, 17 deletions
diff --git a/gentoobrowse-api/db/schema.sql b/gentoobrowse-api/db/schema.sql
index afd47af..ec56da2 100644
--- a/gentoobrowse-api/db/schema.sql
+++ b/gentoobrowse-api/db/schema.sql
@@ -363,8 +363,7 @@ ALTER FUNCTION gentoobrowse.filecontent(f files) OWNER TO gentoo;
CREATE TABLE filetypes (
filetypeid integer NOT NULL,
description text NOT NULL,
- spec filterspec[] NOT NULL,
- processOrder integer
+ spec filterspec[] NOT NULL
);
ALTER TABLE filetypes OWNER TO gentoo;
-- Name: TABLE filetypes; Type: COMMENT; Schema: gentoobrowse; Owner: gentoo
diff --git a/gentoobrowse-api/service/maintenancePackageTree.cpp b/gentoobrowse-api/service/maintenancePackageTree.cpp
index 5e3d4f4..f5a06de 100644
--- a/gentoobrowse-api/service/maintenancePackageTree.cpp
+++ b/gentoobrowse-api/service/maintenancePackageTree.cpp
@@ -175,7 +175,11 @@ namespace Gentoo {
tp.beforeDelete = boost::bind(&Maintenance::fileDeleted, this, dbc, &fps, tmp, _1);
tp.beforeUpdate = boost::bind(&Maintenance::fileChanged, this, dbc, &fps, tmp, _1);
tp.beforeInsert = boost::bind(&Maintenance::fileCreated, this, dbc, &fps, tmp, _1);
- DB::StaticSqlWriter obpo("processOrder NULLS LAST");
+ DB::StaticSqlWriter obpo("CASE \
+ WHEN b.fileTypeId = 1 THEN 1 \
+ WHEN b.fileTypeId = 10 THEN 2 \
+ WHEN b.fileTypeId = 4 THEN 3 \
+ END NULLS LAST");
tp.order = &obpo;
dbc->patchTable(&tp);
for (const auto & fp : fps) {
diff --git a/gentoobrowse-api/service/sql/maintenance/fileListCreate.sql b/gentoobrowse-api/service/sql/maintenance/fileListCreate.sql
index d8d627c..76d5536 100644
--- a/gentoobrowse-api/service/sql/maintenance/fileListCreate.sql
+++ b/gentoobrowse-api/service/sql/maintenance/fileListCreate.sql
@@ -3,7 +3,6 @@ SELECT
r.repoid,
fl.filename,
ft.filetypeid,
- ft.processOrder,
(STRING_TO_ARRAY(fl.filename, '/'))[2:100] pathparts,
fl.filesize,
fl.filemtime moddate
diff --git a/gentoobrowse-api/unittests/basedata.sql b/gentoobrowse-api/unittests/basedata.sql
index 6a77ede..e8e3d55 100644
--- a/gentoobrowse-api/unittests/basedata.sql
+++ b/gentoobrowse-api/unittests/basedata.sql
@@ -6,4 +6,4 @@ SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = gentoobrowse, pg_catalog;
-COPY gentoobrowse.filetypes (filetypeid, description, spec, processOrder) FROM '$SCRIPTDIR/fixtures/filetypes.dat';
+COPY gentoobrowse.filetypes (filetypeid, description, spec) FROM '$SCRIPTDIR/fixtures/filetypes.dat';
diff --git a/gentoobrowse-api/unittests/data.sql b/gentoobrowse-api/unittests/data.sql
index d1c792d..859e16f 100644
--- a/gentoobrowse-api/unittests/data.sql
+++ b/gentoobrowse-api/unittests/data.sql
@@ -17,7 +17,7 @@ COPY gentoobrowse.masksets (setno, person, email, dateadded, message, n, atomspe
COPY gentoobrowse.ebuild_masks (setno, ebuildid) FROM '$SCRIPTDIR/fixtures/ebuild_masks.dat';
COPY gentoobrowse.ebuild_rdeps (ebuildid, packageid, versionspec, flags, op, slot) FROM '$SCRIPTDIR/fixtures/ebuild_rdeps.dat';
COPY gentoobrowse.ebuild_uses (ebuildid, use) FROM '$SCRIPTDIR/fixtures/ebuild_uses.dat';
-COPY gentoobrowse.filetypes (filetypeid, description, spec, processOrder) FROM '$SCRIPTDIR/fixtures/filetypes.dat';
+COPY gentoobrowse.filetypes (filetypeid, description, spec) FROM '$SCRIPTDIR/fixtures/filetypes.dat';
COPY gentoobrowse.files (filename, fileid, moddate, firstseen, cachedat, filetypeid, repoid, filesize, pathparts, encoding) FROM '$SCRIPTDIR/fixtures/files.dat';
COPY gentoobrowse.license (name, legalbumph) FROM '$SCRIPTDIR/fixtures/license.dat';
COPY gentoobrowse.news (newsid, title, posted, authorname, authoremail, atomspec, body, urls) FROM '$SCRIPTDIR/fixtures/news.dat';
diff --git a/gentoobrowse-api/unittests/fixtures/filetypes.dat b/gentoobrowse-api/unittests/fixtures/filetypes.dat
index 5d8ed02..5144c64 100644
--- a/gentoobrowse-api/unittests/fixtures/filetypes.dat
+++ b/gentoobrowse-api/unittests/fixtures/filetypes.dat
@@ -1,11 +1,11 @@
-2 changelog {"(3,ChangeLog)"} \N
-3 masks {"(1,profiles)","(2,package.mask)"} \N
-7 licenses {"(1,licenses)"} \N
-8 manifests {"(3,Manifest)"} \N
-9 use_grouped {"(1,profiles)","(2,desc)","(3,%.desc)"} \N
-5 use_global {"(1,profiles)","(2,use.desc)"} \N
-6 use_local {"(1,profiles)","(2,use.local.desc)"} \N
-1 ebuild metadata {"(1,metadata)","(2,md5-cache)"} 1
-10 category metadata.xml {"(2,metadata.xml)"} 2
-4 package metadata.xml {"(3,metadata.xml)"} 3
-11 news {"(1,metadata)","(2,news)","(4,%.txt)"} \N
+2 changelog {"(3,ChangeLog)"}
+3 masks {"(1,profiles)","(2,package.mask)"}
+7 licenses {"(1,licenses)"}
+8 manifests {"(3,Manifest)"}
+9 use_grouped {"(1,profiles)","(2,desc)","(3,%.desc)"}
+5 use_global {"(1,profiles)","(2,use.desc)"}
+6 use_local {"(1,profiles)","(2,use.local.desc)"}
+1 ebuild metadata {"(1,metadata)","(2,md5-cache)"}
+10 category metadata.xml {"(2,metadata.xml)"}
+4 package metadata.xml {"(3,metadata.xml)"}
+11 news {"(1,metadata)","(2,news)","(4,%.txt)"}