ood method should update the row instead of just adding a new row now. It also has some logic to return a list of new, unadded manga when updating urls
This commit is contained in:
11
main.py
11
main.py
@@ -171,7 +171,8 @@ def upgrade():
|
|||||||
@app.route('/ood/', methods=['GET'])
|
@app.route('/ood/', methods=['GET'])
|
||||||
def ood():
|
def ood():
|
||||||
|
|
||||||
added = []
|
updated = []
|
||||||
|
unadded = []
|
||||||
|
|
||||||
url = []
|
url = []
|
||||||
base = []
|
base = []
|
||||||
@@ -204,10 +205,14 @@ def ood():
|
|||||||
# query = manga(name=name[z], url=url[z], url_flag=str(base[z]), view_format=0, unknown_value=0)
|
# query = manga(name=name[z], url=url[z], url_flag=str(base[z]), view_format=0, unknown_value=0)
|
||||||
result.url = url[z]
|
result.url = url[z]
|
||||||
new_manga['title'] = name[z]
|
new_manga['title'] = name[z]
|
||||||
added.append(new_manga)
|
updated.append(new_manga)
|
||||||
|
else:
|
||||||
|
new_manga = {}
|
||||||
|
new_manga['title'] = name[z]
|
||||||
|
unadded.append(new_manga)
|
||||||
z = z + 1
|
z = z + 1
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return jsonify(updated=added)
|
return jsonify(updated=updated, unadded=unadded)
|
||||||
|
|
||||||
@app.route('/test/', methods=['GET'])
|
@app.route('/test/', methods=['GET'])
|
||||||
def test():
|
def test():
|
||||||
|
|||||||
Reference in New Issue
Block a user