Compare commits

..

4 Commits

Author SHA1 Message Date
Pierre Ducroquet 817875d6cb sql: test purge of search tokens (#86527)
gitea/wcs/pipeline/head This commit looks good Details
2024-04-22 14:46:38 +02:00
Pierre Ducroquet f6e4bc03f8 wcs_search_tokens: new FTS mechanism with fuzzy-match (#86527)
introduce a new mechanism to implement FTS with fuzzy-match.
This is made possible by adding and maintaining a table of the
FTS tokens, wcs_search_tokens, fed with searchable_formdefs
and wcs_all_forms.
When a query is issued, its tokens are matched against the
tokens with a fuzzy match when no direct match is found, and
the query is then rebuilt.
2024-04-22 14:46:38 +02:00
Pierre Ducroquet 07fad5808c tests: add a test for new FTS on formdefs (#86527) 2024-04-22 14:46:38 +02:00
Valentin Deniaud d6771b2869 admin: allow numeric field inside block during test edit (#89734)
gitea/wcs/pipeline/head This commit looks good Details
2024-04-22 11:41:22 +02:00
2 changed files with 31 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import datetime
import decimal
import os
import pytest
@ -33,6 +34,7 @@ def pub():
pub.write_cfg()
pub.user_class.wipe()
BlockDef.wipe()
FormDef.wipe()
TestDef.wipe()
TestResult.wipe()
@ -871,6 +873,34 @@ def test_tests_edit_data_live_url(formdef_class, pub):
assert live_resp.json['result']['3']['visible'] is True
def test_tests_edit_data_numeric_field(pub):
create_superuser(pub)
block = BlockDef()
block.name = 'foobar'
block.fields = [fields.NumericField(id='1', label='Numeric', varname='foo')]
block.store()
formdef = FormDef()
formdef.name = 'test title'
formdef.fields = [
fields.BlockField(id='1', label='Block Data', varname='blockdata', block_slug='foobar', max_items=3),
]
formdef.store()
formdata = formdef.data_class()()
formdata.data['1'] = {'data': [{'1': decimal.Decimal(42)}]}
testdef = TestDef.create_from_formdata(formdef, formdata)
testdef.store()
app = login(get_app(pub))
resp = app.get(testdef.get_admin_url() + 'edit-data/')
resp = resp.click('Switch to backoffice mode.').follow()
resp = resp.form.submit('submit').follow()
def test_tests_manual_run(pub):
user = create_superuser(pub)

View File

@ -70,6 +70,7 @@ from .qommon.template import Template, TemplateError
def posted_json_data_to_formdata_data(formdef, data):
data = copy.deepcopy(data)
# remap fields from varname to field id
for field in formdef.get_all_fields():
if not field.varname: