@@ -209,6 +209,7 @@ export class LanguageRepository extends DtoRepository<
209
209
] )
210
210
. apply ( matchProps ( { nodeName : 'eth' , outputVar : 'ethProps' } ) )
211
211
. apply ( isPresetInventory )
212
+ . apply ( usingAIAssistance )
212
213
. optionalMatch ( [
213
214
node ( 'node' ) ,
214
215
relation ( 'in' , '' , 'language' , ACTIVE ) ,
@@ -222,6 +223,7 @@ export class LanguageRepository extends DtoRepository<
222
223
ethnologue : 'ethProps' ,
223
224
pinned,
224
225
presetInventory : 'presetInventory' ,
226
+ usesAIAssistance : 'coalesce(usesAIAssistance, false)' ,
225
227
firstScriptureEngagement : 'firstScriptureEngagement { .id }' ,
226
228
scope : 'scopedRoles' ,
227
229
changeset : 'changeset.id' ,
@@ -339,6 +341,10 @@ export const languageFilters = filter.define(() => LanguageFilters, {
339
341
const condition = equals ( 'true' , true ) ;
340
342
return { presetInventory : value ? condition : not ( condition ) } ;
341
343
} ,
344
+ usesAIAssistance : ( { value, query } ) => {
345
+ query . apply ( usingAIAssistance ) . with ( [ 'node' , 'usesAIAssistance' ] ) ;
346
+ return { usesAIAssistance : value } ;
347
+ } ,
342
348
} ) ;
343
349
344
350
const ethnologueFilters = filter . define ( ( ) => EthnologueLanguageFilters , {
@@ -374,6 +380,25 @@ const isPresetInventory = (query: Query) =>
374
380
) ,
375
381
) ;
376
382
383
+ const usingAIAssistance = ( query : Query ) =>
384
+ query . subQuery ( 'node' , ( sub ) =>
385
+ sub
386
+ . optionalMatch ( [
387
+ node ( 'node' ) ,
388
+ relation ( 'in' , '' , 'language' , ACTIVE ) ,
389
+ node ( 'eng' , 'LanguageEngagement' ) ,
390
+ ] )
391
+ . optionalMatch ( [
392
+ node ( 'eng' ) ,
393
+ relation ( 'out' , '' , 'usingAIAssistedTranslation' , ACTIVE ) ,
394
+ node ( 'prop' , 'Property' ) ,
395
+ ] )
396
+ . with ( [
397
+ `any(val in collect(prop.value) WHERE val IS NOT NULL AND val <> 'None' AND val <> 'Unknown') as usesAIAssistance` ,
398
+ ] )
399
+ . return ( [ 'usesAIAssistance' ] ) ,
400
+ ) ;
401
+
377
402
export const languageSorters = defineSorters ( Language , {
378
403
// eslint-disable-next-line @typescript-eslint/naming-convention
379
404
'ethnologue.*' : ( query , input ) =>
@@ -405,6 +430,11 @@ export const languageSorters = defineSorters(Language, {
405
430
. return < { sortValue : unknown } > (
406
431
coalesce ( 'override.value' , 'canonical.value' ) . as ( 'sortValue' ) ,
407
432
) ,
433
+ usesAIAssistance : ( query ) =>
434
+ query
435
+ . apply ( usingAIAssistance )
436
+ . with ( [ 'node' , 'usesAIAssistance as sortValue' ] )
437
+ . return < { sortValue : unknown } > ( 'sortValue' ) ,
408
438
} ) ;
409
439
410
440
const ethnologueSorters = defineSorters ( EthnologueLanguage , { } ) ;
0 commit comments