Skip to content

Commit

Permalink
wrong number of params used in method
Browse files Browse the repository at this point in the history
  • Loading branch information
7h3Rabbit committed Oct 10, 2024
1 parent bc72cc0 commit b640cf0
Showing 1 changed file with 25 additions and 29 deletions.
54 changes: 25 additions & 29 deletions engines/sql.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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)

0 comments on commit b640cf0

Please sign in to comment.