Skip to content
Snippets Groups Projects
Commit 83eab912 authored by esikkala's avatar esikkala
Browse files

Paginated results: special sorting for timespans

parent a4cf0093
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,8 @@ export const facetConfigs = { ...@@ -33,7 +33,8 @@ export const facetConfigs = {
productionTimespan: { productionTimespan: {
id: 'productionTimespan', id: 'productionTimespan',
facetValueFilter: '', facetValueFilter: '',
labelPath: '^crm:P108_has_produced/crm:P4_has_time-span/crm:P82a_begin_of_the_begin', sortByAscPredicate: '^crm:P108_has_produced/crm:P4_has_time-span/crm:P82a_begin_of_the_begin',
sortByDescPredicate: '^crm:P108_has_produced/crm:P4_has_time-span/crm:P82b_end_of_the_end',
predicate: '^crm:P108_has_produced/crm:P4_has_time-span', predicate: '^crm:P108_has_produced/crm:P4_has_time-span',
startProperty: 'crm:P82a_begin_of_the_begin', startProperty: 'crm:P82a_begin_of_the_begin',
endProperty: 'crm:P82b_end_of_the_end', endProperty: 'crm:P82b_end_of_the_end',
......
...@@ -167,7 +167,14 @@ const getPaginatedData = ({ ...@@ -167,7 +167,14 @@ const getPaginatedData = ({
facetID: null})); facetID: null}));
} }
q = q.replace('<FACET_CLASS>', facetConfig.facetClass); q = q.replace('<FACET_CLASS>', facetConfig.facetClass);
q = q.replace('<ORDER_BY_PREDICATE>', facetConfig[sortBy].labelPath); if (sortBy.endsWith('Timespan')) {
q = q.replace('<ORDER_BY_PREDICATE>',
sortDirection === 'asc'
? facetConfig[sortBy].sortByAscPredicate
: facetConfig[sortBy].sortByDescPredicate);
} else {
q = q.replace('<ORDER_BY_PREDICATE>', facetConfig[sortBy].labelPath);
}
q = q.replace('<SORT_DIRECTION>', sortDirection); q = q.replace('<SORT_DIRECTION>', sortDirection);
q = q.replace('<PAGE>', `LIMIT ${pagesize} OFFSET ${page * pagesize}`); q = q.replace('<PAGE>', `LIMIT ${pagesize} OFFSET ${page * pagesize}`);
let resultSetProperties; let resultSetProperties;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment