Skip to content

Commit

Permalink
fix listing documents query
Browse files Browse the repository at this point in the history
  • Loading branch information
mzimandl committed Jul 28, 2023
1 parent 71fd3db commit c3f7d95
Showing 1 changed file with 52 additions and 49 deletions.
101 changes: 52 additions & 49 deletions public/files/js/plugins/liveAttributes/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,56 +618,59 @@ export class LiveAttrsModel extends StatelessModel<LiveAttrsModelState> implemen
laligned:Array<string>;
lattrs:{[k:string]:Array<string>};
} {
return pipe(
state.selectionSteps,
List.foldl<
TTSelectionStep|AlignedLangSelectionStep,
{
corpname:string,
laligned:Array<string>,
lattrs: {[k:string]:Array<string>}
}
>(
(acc, v) => {
if (isAlignedSelectionStep(v)) {
acc.laligned = v.attributes;
return acc;

} else {
acc.lattrs = Dict.mergeDict(
(o, n) => n,
Dict.map(
(v, k) => {
if (v.type === 'encoded') {
return [v.decodedValue];
}
return v.selections;
},
v.values
),
acc.lattrs,
);
return acc;
let initData = {
corpname: state.firstCorpus,
laligned: pipe(
state.initialAlignedCorpora,
List.filter(v => v.selected),
List.map(v => v.value),
),
lattrs: pipe(
state.subcorpDefinition,
Dict.map((selections, k) => {
if (Array.isArray(selections))
return selections
return [TextTypes.isExportedRegexpSelection(selections) ? selections.regexp : selections]
})
),
};
return state.selectionSteps.length == 0 ?
initData :
pipe(
state.selectionSteps,
List.foldl<
TTSelectionStep|AlignedLangSelectionStep,
{
corpname:string,
laligned:Array<string>,
lattrs: {[k:string]:Array<string>}
}
},
{
corpname: state.firstCorpus,
laligned: pipe(
state.initialAlignedCorpora,
List.filter(v => v.selected),
List.map(v => v.value),
),
lattrs: pipe(
state.subcorpDefinition,
Dict.map((selections, k) => {
if (Array.isArray(selections))
return selections
return [TextTypes.isExportedRegexpSelection(selections) ? selections.regexp : selections]
})
),
}
)
);
>(
(acc, v) => {
if (isAlignedSelectionStep(v)) {
acc.laligned = acc.laligned.concat(v.attributes);
return acc;

} else {
acc.lattrs = Dict.mergeDict(
(o, n) => n,
Dict.map(
(v, k) => {
if (v.type === 'encoded') {
return [v.decodedValue];
}
return v.selections;
},
v.values
),
acc.lattrs,
);
return acc;
}
},
initData
)
);
}

private reloadSizes(state:LiveAttrsModelState, dispatch:SEDispatcher):void {
Expand Down

0 comments on commit c3f7d95

Please sign in to comment.