Skip to content
Snippets Groups Projects
Commit 867db260 authored by Thomas Bock's avatar Thomas Bock :speech_balloon:
Browse files

add next endpoint

parent 88f49f0a
No related branches found
No related tags found
No related merge requests found
......@@ -185,6 +185,14 @@ def pla_convert(pla_doc_id):
return trans.planning_convert(doc=doc)
@app.route('/pla/next/<year>/<cus>', methods=['GET'])
def pla_next(year, cus):
app.logger.debug('hit pla/next/{year}/{cus}'.format(year = year, cus = cus))
if cus:
n = db.view_pla_next("{year}_{cus}".format(year = year, cus = cus))
return jsonify("{0:03d}".format(n+1))
@app.route('/bur/ensure/<doc_id>', methods=['GET'])
def bur_ensure(doc_id ):
app.logger.debug('hit bur/ensure/{doc_id}'.format(doc_id=doc_id))
......
{
"git_dir": ".",
"host": "a73434",
"port": 5984,
"database": "vl_db",
"view": {
"bur_docs": "bur/docs",
"todo_docs": "bur/todo",
"select": "bur/select",
"calibration": "bur/calibrations"
}
"git_dir": ".",
"host": "a73434",
"port": 5984,
"database": "vl_db",
"view": {
"bur_docs": "bur/docs",
"pla_next": "share/pla_year_cus",
"todo_docs": "bur/todo",
"select": "bur/select",
"calibration": "bur/calibrations"
}
}
......@@ -87,6 +87,13 @@ class DB():
else:
return list(self.db.view(view))
def view_pla_next(self, year_cus):
view = self.config["view"]["pla_next"]
if year_cus:
print(year_cus)
print(list(self.db.view(view, key=year_cus)))
return len(list(self.db.view(view, key=year_cus)))
def view_todo_docs(self):
view = self.config["view"]["todo_docs"]
return list(self.db.view(view))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment