Skip to content

Commit 1ab39f9

Browse files
authored
Merge branch 'master' into ui_fix
2 parents f5c9965 + 5edbdee commit 1ab39f9

6 files changed

Lines changed: 25 additions & 15 deletions

File tree

mod_ci/controllers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from lxml import etree
2727
from markdown2 import markdown
2828
from pymysql.err import IntegrityError
29-
from sqlalchemy import and_, func
29+
from sqlalchemy import and_, func, select
3030
from sqlalchemy.sql import label
3131
from sqlalchemy.sql.functions import count
3232
from werkzeug.utils import secure_filename
@@ -2431,9 +2431,9 @@ def progress_type_request(log, test, test_id, request) -> bool:
24312431
TestResult.test_id == test.id,
24322432
TestResult.exit_code != TestResult.expected_rc
24332433
)).scalar()
2434-
results_zero_rc = g.db.query(RegressionTest.id).filter(
2434+
results_zero_rc = select(RegressionTest.id).filter(
24352435
RegressionTest.expected_rc == 0
2436-
).subquery()
2436+
)
24372437
results = g.db.query(count(TestResultFile.got)).filter(
24382438
and_(
24392439
TestResultFile.test_id == test.id,
@@ -2509,13 +2509,13 @@ def update_final_status():
25092509
total_time = 0
25102510

25112511
if current_average is None:
2512-
platform_tests = g.db.query(Test.id).filter(Test.platform == test.platform).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(
25142514
and_(
25152515
TestProgress.status.in_([TestStatus.canceled, TestStatus.completed]),
25162516
TestProgress.test_id.in_(platform_tests)
25172517
)
2518-
).subquery()
2518+
)
25192519
in_progress_statuses = [TestStatus.preparation, TestStatus.completed, TestStatus.canceled]
25202520
finished_tests_progress = g.db.query(TestProgress).filter(
25212521
and_(

mod_customized/controllers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from flask import Blueprint, g, redirect, request, url_for
66
from github import Auth, Github, GithubException
7-
from sqlalchemy import and_
7+
from sqlalchemy import and_, select
88

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

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

8787
tests = Test.query.filter(and_(TestFork.user_id == g.user.id, TestFork.test_id == Test.id)).order_by(

mod_sample/controllers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from typing import Any, Dict
66

77
from flask import Blueprint, g, redirect, request, url_for
8+
from sqlalchemy import select
89

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

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

8485
if test_release is not None:
85-
sq = g.db.query(RegressionTest.id).filter(
86-
RegressionTest.sample_id == sample.id).subquery()
86+
sq = select(RegressionTest.id).filter(
87+
RegressionTest.sample_id == sample.id)
8788
exit_code = g.db.query(TestResult.exit_code).filter(
8889
and_(
8990
TestResult.exit_code != TestResult.expected_rc,

mod_test/controllers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from flask import (Blueprint, Response, abort, g, jsonify, redirect, request,
77
url_for)
8-
from sqlalchemy import and_
8+
from sqlalchemy import and_, select
99

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

templates/regression/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ <h5>Regression tests</h5>
216216

217217
$(document).ready(function(){
218218
const urlParams = new URLSearchParams(window.location.search);
219-
const hash = urlParams.get("category");
220-
if(hash === "") hash = "1";
219+
let hash = urlParams.get("category");
220+
if(!hash || hash === "") hash = "1";
221221
$("#category").find("option").each(function(idx, elm){
222222
if($(elm).val() === hash){
223223
$(elm).attr("selected",true);

tests/test_regression/test_controllers.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,3 +566,12 @@ def test_add_test_output_and_check_double_hashes(self):
566566
).count(),
567567
1
568568
)
569+
570+
def test_category_description_shown_without_tags(self):
571+
"""Test that category description is shown when accessing /regression/ with category parameter but no tags."""
572+
response = self.app.test_client().get('/regression/?category=1')
573+
self.assertEqual(response.status_code, 200)
574+
# Check that the category description span is present and not hidden
575+
self.assertIn('data-category="1"', str(response.data))
576+
# The JavaScript should ensure the description is visible, but we can't test JS execution in unit tests
577+
# This test verifies the HTML structure is correct for the fix to work

0 commit comments

Comments
 (0)