Skip to content

Commit

Permalink
Merge pull request #6254 from tomachalek/preflight_rewrite
Browse files Browse the repository at this point in the history
Fix - no alt. corpus available must be handled gracefully
  • Loading branch information
tomachalek authored Jul 12, 2024
2 parents 2af5df5 + 988ea25 commit 56f7305
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/plugins/default_query_suggest/backends/cqlizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ async def find_suggestion(
'SELECT alt_corpus_name FROM kontext_alt_corpus WHERE corpus_name = %s',
(maincorp.corpname,))
row = await cursor.fetchone()
data['alt_corpus'] = row[0]
data['alt_corpus'] = None if row is None else row[0]
return data
14 changes: 10 additions & 4 deletions public/files/js/plugins/querySuggest/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,16 @@ export function init(

return <S.ExhaustiveQueryInfo>
<p>{he.translate('defaultTD__exhaustiveQueryWarn')}</p>

<p><a onClick={handler}>{he.translate('defaultTD__exhaustiveQueryAltCorpLink_{corpname}', {corpname: props.altCorpus})}</a>
{'\u00a0'}
({he.translate('defaultTD__recomm_corp_link_note')})</p>
{props.altCorpus ?
<>
<p>
<a onClick={handler}>{he.translate('defaultTD__exhaustiveQueryAltCorpLink_{corpname}', {corpname: props.altCorpus})}</a>
{'\u00a0'}
({he.translate('defaultTD__recomm_corp_link_note')})
</p>
</> :
null
}
</S.ExhaustiveQueryInfo>;

};
Expand Down

0 comments on commit 56f7305

Please sign in to comment.