Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions mod_ci/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from lxml import etree
from markdown2 import markdown
from pymysql.err import IntegrityError
from sqlalchemy import and_, func
from sqlalchemy import and_, func, select
from sqlalchemy.sql import label
from sqlalchemy.sql.functions import count
from werkzeug.utils import secure_filename
Expand Down Expand Up @@ -2431,9 +2431,9 @@ def progress_type_request(log, test, test_id, request) -> bool:
TestResult.test_id == test.id,
TestResult.exit_code != TestResult.expected_rc
)).scalar()
results_zero_rc = g.db.query(RegressionTest.id).filter(
results_zero_rc = select(RegressionTest.id).filter(
RegressionTest.expected_rc == 0
).subquery()
)
results = g.db.query(count(TestResultFile.got)).filter(
and_(
TestResultFile.test_id == test.id,
Expand Down Expand Up @@ -2509,13 +2509,13 @@ def update_final_status():
total_time = 0

if current_average is None:
platform_tests = g.db.query(Test.id).filter(Test.platform == test.platform).subquery()
finished_tests = g.db.query(TestProgress.test_id).filter(
platform_tests = select(Test.id).filter(Test.platform == test.platform)
finished_tests = select(TestProgress.test_id).filter(
and_(
TestProgress.status.in_([TestStatus.canceled, TestStatus.completed]),
TestProgress.test_id.in_(platform_tests)
)
).subquery()
)
in_progress_statuses = [TestStatus.preparation, TestStatus.completed, TestStatus.canceled]
finished_tests_progress = g.db.query(TestProgress).filter(
and_(
Expand Down
4 changes: 2 additions & 2 deletions mod_customized/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from flask import Blueprint, g, redirect, request, url_for
from github import Auth, Github, GithubException
from sqlalchemy import and_
from sqlalchemy import and_, select

from decorators import template_renderer
from mod_auth.controllers import (check_access_rights,
Expand Down Expand Up @@ -81,7 +81,7 @@ def index():
elif username is not None:
g.log.error('GitHub token not configured, cannot fetch commits')

populated_categories = g.db.query(regressionTestLinkTable.c.category_id).subquery()
populated_categories = select(regressionTestLinkTable.c.category_id)
categories = Category.query.filter(Category.id.in_(populated_categories)).order_by(Category.name.asc()).all()

tests = Test.query.filter(and_(TestFork.user_id == g.user.id, TestFork.test_id == Test.id)).order_by(
Expand Down
7 changes: 4 additions & 3 deletions mod_sample/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Any, Dict

from flask import Blueprint, g, redirect, request, url_for
from sqlalchemy import select

from decorators import template_renderer
from exceptions import SampleNotFoundException
Expand Down Expand Up @@ -66,7 +67,7 @@ def display_sample_info(sample) -> Dict[str, Any]:

if len(regression_tests) > 0:
if test_commit is not None:
sq = g.db.query(RegressionTest.id).filter(RegressionTest.sample_id == sample.id).subquery()
sq = select(RegressionTest.id).filter(RegressionTest.sample_id == sample.id)
exit_code = g.db.query(TestResult.exit_code).filter(and_(
TestResult.exit_code != TestResult.expected_rc,
and_(TestResult.test_id == test_commit.id, TestResult.regression_test_id.in_(sq))
Expand All @@ -82,8 +83,8 @@ def display_sample_info(sample) -> Dict[str, Any]:
status = 'Fail'

if test_release is not None:
sq = g.db.query(RegressionTest.id).filter(
RegressionTest.sample_id == sample.id).subquery()
sq = select(RegressionTest.id).filter(
RegressionTest.sample_id == sample.id)
exit_code = g.db.query(TestResult.exit_code).filter(
and_(
TestResult.exit_code != TestResult.expected_rc,
Expand Down
4 changes: 2 additions & 2 deletions mod_test/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from flask import (Blueprint, Response, abort, g, jsonify, redirect, request,
url_for)
from sqlalchemy import and_
from sqlalchemy import and_, select

from decorators import template_renderer
from exceptions import TestNotFoundException
Expand Down Expand Up @@ -60,7 +60,7 @@ def get_test_results(test) -> List[Dict[str, Any]]:
:param test: The test to retrieve the data for.
:type test: Test
"""
populated_categories = g.db.query(regressionTestLinkTable.c.category_id).subquery()
populated_categories = select(regressionTestLinkTable.c.category_id)
categories = Category.query.filter(Category.id.in_(populated_categories)).order_by(Category.name.asc()).all()
results = [{
'category': category,
Expand Down
Loading