From 9940b908b695251553ea399ccc33c025897b8d85 Mon Sep 17 00:00:00 2001 From: boyska Date: Tue, 15 Apr 2014 01:35:14 +0200 Subject: [PATCH] Add archive.html (not linked anywhere) --- server/.gitignore | 1 + server/pages/archive.html | 61 +++++++++++++++++++++++++++++++++++++++ server/server.py | 8 +++++ server/static/js/rec.js | 3 ++ server/techrec.py | 5 ++++ 5 files changed, 78 insertions(+) create mode 100644 server/pages/archive.html diff --git a/server/.gitignore b/server/.gitignore index b16e8f5..294ad09 100644 --- a/server/.gitignore +++ b/server/.gitignore @@ -1,2 +1,3 @@ *.db *.mp3 +.*.swo diff --git a/server/pages/archive.html b/server/pages/archive.html new file mode 100644 index 0000000..0cc3220 --- /dev/null +++ b/server/pages/archive.html @@ -0,0 +1,61 @@ + + + + + TechREC + + + + + + + + + + + + + + + + +
+ TechRec + +
+ +

Registrazioni già completate

+
+
+
+ + + + + + +
Filename
+
+
+
+ + + + + diff --git a/server/server.py b/server/server.py index 112c333..40bdeb0 100644 --- a/server/server.py +++ b/server/server.py @@ -84,6 +84,7 @@ class RecAPI(Bottle): self.get('/', callback=self.help) self.get('/get/search', callback=self.search) self.get('/get/ongoing', callback=self.get_ongoing) + self.get('/get/archive', callback=self.get_archive) self.get('/jobs', callback=self.running_jobs) self.get('/jobs/', callback=self.check_job) @@ -233,6 +234,10 @@ class RecAPI(Bottle): return {rec.id: rec_sanitize(rec) for rec in self.db.get_ongoing()} + def get_archive(self): + return {rec.id: rec_sanitize(rec) + for rec in self.db.get_archive_recent()} + # @route('/help') def help(self): return "

help


\ @@ -283,6 +288,9 @@ class RecServer: self._app.route('/old.html', callback=partial(static_file, 'old.html', root='pages/')) + self._app.route('/archive.html', + callback=partial(static_file, 'archive.html', + root='pages/')) class DebugAPI(Bottle): diff --git a/server/static/js/rec.js b/server/static/js/rec.js index 2a7b8b6..c698591 100644 --- a/server/static/js/rec.js +++ b/server/static/js/rec.js @@ -43,6 +43,9 @@ var RecAPI = { id: rec.id }); }, + get_archive: function() { + return $.getJSON('/api/get/archive'); + }, get_ongoing: function() { return $.getJSON('/api/get/ongoing'); } diff --git a/server/techrec.py b/server/techrec.py index 98b64e1..7950090 100644 --- a/server/techrec.py +++ b/server/techrec.py @@ -142,6 +142,11 @@ class RecDB: query = self._query_older(timedelta(seconds=minseconds), query) return query.all() + def get_archive_recent(self): + query = self._query_saved() + query = self._query_newer(timedelta(days=15), query) + return query.all() + def _query_ongoing(self, query=None): ''' Not terminated AND recent.