|
26 | 26 | from lxml import etree |
27 | 27 | from markdown2 import markdown |
28 | 28 | from pymysql.err import IntegrityError |
29 | | -from sqlalchemy import and_, func |
| 29 | +from sqlalchemy import and_, func, select |
30 | 30 | from sqlalchemy.sql import label |
31 | 31 | from sqlalchemy.sql.functions import count |
32 | 32 | from werkzeug.utils import secure_filename |
@@ -2431,9 +2431,9 @@ def progress_type_request(log, test, test_id, request) -> bool: |
2431 | 2431 | TestResult.test_id == test.id, |
2432 | 2432 | TestResult.exit_code != TestResult.expected_rc |
2433 | 2433 | )).scalar() |
2434 | | - results_zero_rc = g.db.query(RegressionTest.id).filter( |
| 2434 | + results_zero_rc = select(RegressionTest.id).filter( |
2435 | 2435 | RegressionTest.expected_rc == 0 |
2436 | | - ).scalar_subquery() |
| 2436 | + ) |
2437 | 2437 | results = g.db.query(count(TestResultFile.got)).filter( |
2438 | 2438 | and_( |
2439 | 2439 | TestResultFile.test_id == test.id, |
@@ -2509,13 +2509,13 @@ def update_final_status(): |
2509 | 2509 | total_time = 0 |
2510 | 2510 |
|
2511 | 2511 | if current_average is None: |
2512 | | - platform_tests = g.db.query(Test.id).filter(Test.platform == test.platform).scalar_subquery() |
2513 | | - finished_tests = g.db.query(TestProgress.test_id).filter( |
| 2512 | + platform_tests = select(Test.id).filter(Test.platform == test.platform) |
| 2513 | + finished_tests = select(TestProgress.test_id).filter( |
2514 | 2514 | and_( |
2515 | 2515 | TestProgress.status.in_([TestStatus.canceled, TestStatus.completed]), |
2516 | 2516 | TestProgress.test_id.in_(platform_tests) |
2517 | 2517 | ) |
2518 | | - ).scalar_subquery() |
| 2518 | + ) |
2519 | 2519 | in_progress_statuses = [TestStatus.preparation, TestStatus.completed, TestStatus.canceled] |
2520 | 2520 | finished_tests_progress = g.db.query(TestProgress).filter( |
2521 | 2521 | and_( |
|
0 commit comments