diff --git a/engines/sql.py b/engines/sql.py index 7f60451b..7f2cc4f2 100644 --- a/engines/sql.py +++ b/engines/sql.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- -from engines.utils import use_item -def write_tests(output_filename, site_tests, input_skip, input_take, _, _2): +def write_tests(output_filename, site_tests, _, _2): """ Writes site test results to a file from a given list of site tests. @@ -17,33 +16,30 @@ def write_tests(output_filename, site_tests, input_skip, input_take, _, _2): None """ with open(output_filename, 'w', encoding='utf-8') as outfile: - current_index = 0 for test in site_tests: - if use_item(current_index, input_skip, input_take): - # update testresult for all sites - format_str = """INSERT INTO sitetests (site_id, test_date, type_of_test, - check_report, check_report_sec, check_report_perf, check_report_a11y, check_report_stand, - json_check_data, most_recent, rating, rating_sec, rating_perf, rating_a11y, rating_stand) - VALUES ("{siteid}", "{testdate}", "{testtype}", "{report}", "{report_sec}", - "{report_perf}", "{report_a11y}", "{report_stand}", "{json}", "{recent}", - "{rating}", "{rating_sec}", "{rating_perf}", "{rating_a11y}", - "{rating_stand}");\n""" - sql_command = format_str.format( - siteid=test["site_id"], - testdate=test["date"], - testtype=test["type_of_test"], - report=test["report"], - report_sec=test["report_sec"], - report_perf=test["report_perf"], - report_a11y=test["report_a11y"], - report_stand=test["report_stand"], - json=test["data"], - recent=1, - rating=test["rating"], - rating_sec=test["rating_sec"], - rating_perf=test["rating_perf"], - rating_a11y=test["rating_a11y"], - rating_stand=test["rating_stand"] + # update testresult for all sites + format_str = """INSERT INTO sitetests (site_id, test_date, type_of_test, + check_report, check_report_sec, check_report_perf, check_report_a11y, check_report_stand, + json_check_data, most_recent, rating, rating_sec, rating_perf, rating_a11y, rating_stand) + VALUES ("{siteid}", "{testdate}", "{testtype}", "{report}", "{report_sec}", + "{report_perf}", "{report_a11y}", "{report_stand}", "{json}", "{recent}", + "{rating}", "{rating_sec}", "{rating_perf}", "{rating_a11y}", + "{rating_stand}");\n""" + sql_command = format_str.format( + siteid=test["site_id"], + testdate=test["date"], + testtype=test["type_of_test"], + report=test["report"], + report_sec=test["report_sec"], + report_perf=test["report_perf"], + report_a11y=test["report_a11y"], + report_stand=test["report_stand"], + json=test["data"], + recent=1, + rating=test["rating"], + rating_sec=test["rating_sec"], + rating_perf=test["rating_perf"], + rating_a11y=test["rating_a11y"], + rating_stand=test["rating_stand"] ) - current_index += 1 outfile.write(sql_command)