|
|
|
@ -247,6 +247,10 @@ def create_path_mapping(): |
|
|
|
and 'detail_id' in request.form |
|
|
|
and 'detail_id' in request.form |
|
|
|
): |
|
|
|
): |
|
|
|
errors.append(f'required parameters: rel_path, id') |
|
|
|
errors.append(f'required parameters: rel_path, id') |
|
|
|
|
|
|
|
elif request.form['rel_path'] is '': |
|
|
|
|
|
|
|
errors.append('rel_path is empty') |
|
|
|
|
|
|
|
elif request.form['detail_id'] is '0': |
|
|
|
|
|
|
|
errors.append('detail_id is unset') |
|
|
|
else: |
|
|
|
else: |
|
|
|
detail_id = request.form['detail_id'] |
|
|
|
detail_id = request.form['detail_id'] |
|
|
|
rel_path = request.form['rel_path'] |
|
|
|
rel_path = request.form['rel_path'] |
|
|
|
@ -292,12 +296,6 @@ def doQueryAlgorithm(query:query_data) -> dict: |
|
|
|
except json.JSONDecodeError as e: |
|
|
|
except json.JSONDecodeError as e: |
|
|
|
errors.append(e) |
|
|
|
errors.append(e) |
|
|
|
|
|
|
|
|
|
|
|
# TODO: testing ############ |
|
|
|
|
|
|
|
errors.extend(query.errors) |
|
|
|
|
|
|
|
errors.extend(response.errors) |
|
|
|
|
|
|
|
return {'errors': errors, 'results': view_results} |
|
|
|
|
|
|
|
########################### |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if response.parsed_response and 'total_results' in response.parsed_response: |
|
|
|
if response.parsed_response and 'total_results' in response.parsed_response: |
|
|
|
response.result_count = response.parsed_response['total_results'] |
|
|
|
response.result_count = response.parsed_response['total_results'] |
|
|
|
|
|
|
|
|
|
|
|
@ -390,6 +388,10 @@ def makeLocalQuery(query_obj): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def buildViewResult(db_row): |
|
|
|
def buildViewResult(db_row): |
|
|
|
|
|
|
|
if not db_row: |
|
|
|
|
|
|
|
current_app.logger.error('empty db_row parameter') |
|
|
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
vr = view_result() |
|
|
|
vr = view_result() |
|
|
|
vr.detail_id = db_row['detail_id'] |
|
|
|
vr.detail_id = db_row['detail_id'] |
|
|
|
vr.media_type = db_row['media_type'] |
|
|
|
vr.media_type = db_row['media_type'] |
|
|
|
@ -530,6 +532,9 @@ def storeTMDBQueryResults(query_obj, result_list): |
|
|
|
(r.id, r.media_type, r.title, r.overview, r.release_date, r.original_language, r.poster_path) |
|
|
|
(r.id, r.media_type, r.title, r.overview, r.release_date, r.original_language, r.poster_path) |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# NOTE: need to set detail_id here to avoid a second query in create_path_mapping |
|
|
|
|
|
|
|
r.detail_id = cur.lastrowid |
|
|
|
|
|
|
|
|
|
|
|
cur.execute(f'INSERT INTO query_mapping(query_id, detail_id)' |
|
|
|
cur.execute(f'INSERT INTO query_mapping(query_id, detail_id)' |
|
|
|
+ ' VALUES (?,?)', (query_id, cur.lastrowid) |
|
|
|
+ ' VALUES (?,?)', (query_id, cur.lastrowid) |
|
|
|
) |
|
|
|
) |
|
|
|
|