Skip to content

Commit

Permalink
aggregation: change for isFiction
Browse files Browse the repository at this point in the history
* Needs rero-ils:#3616

Co-Authored-by: Peter Weber <peter.weber@rero.ch>
  • Loading branch information
rerowep committed Mar 27, 2024
1 parent 7e45842 commit 215c31f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
8 changes: 4 additions & 4 deletions projects/admin/src/app/routes/documents-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ export class DocumentsRoute extends BaseRoute implements RouteInterface {
genreForm: _('Genre, form'),
intendedAudience: _('Intended audience'),
year: _('Publication year'),
subject_fiction: _('Subject (fiction)'),
subject_no_fiction: _('Subject (non-fiction)'),
subject: _('Subject'),
fiction: _('Fiction'),
acquisition: _('Acquisition date'),
},
showFacetsIfNoResults: true,
Expand All @@ -125,8 +125,8 @@ export class DocumentsRoute extends BaseRoute implements RouteInterface {
'language',
'year',
'author',
'subject_no_fiction',
'subject_fiction',
'subject',
'fiction',
'genreForm',
'intendedAudience',
'acquisition',
Expand Down
8 changes: 5 additions & 3 deletions projects/admin/src/app/service/bucket-name.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ export class BucketNameService implements IBucketNameService {
* @returns Observable of string
*/
transform(aggregationKey: string, value: string): Observable<string> {
console.log();
switch (aggregationKey) {
case 'fiction':
const fiction_label = Boolean(value)? _('Fiction') : _('No fiction');
return of(this.translateService.instant(fiction_label));
case 'claims_count':
const label = Number(value) < 2 ? _('{{count}} claim') : _('{{count}} claims');
return of(this.translateService.instant(label, { count: value }));
const claims_label = Number(value) < 2 ? _('{{count}} claim') : _('{{count}} claims');
return of(this.translateService.instant(claims_label, { count: value }));
case 'language': return of(this.translateService.instant(`lang_${value}`));
case 'transaction_library':
case 'library': return this.libraryApiService.getByPid(value).pipe(map(record => record.name));
Expand Down
6 changes: 4 additions & 2 deletions projects/public-search/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { LoadingBarModule } from '@ngx-loading-bar/core';
import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client';
import { LoadingBarRouterModule } from '@ngx-loading-bar/router';
import { TranslateLoader as BaseTranslateLoader, TranslateModule } from '@ngx-translate/core';
import { CoreConfigService, RecordModule, TranslateLoader, TranslateService } from '@rero/ng-core';
import { BucketNameService as CoreBucketNameService, CoreConfigService, RecordModule, TranslateLoader, TranslateService } from '@rero/ng-core';
import { SharedModule } from '@rero/shared';
import { BsLocaleService } from 'ngx-bootstrap/datepicker';
import { TypeaheadModule } from 'ngx-bootstrap/typeahead';
Expand All @@ -39,6 +39,7 @@ import { ErrorPageComponent } from './error/error-page.component';
import { CustomRequestInterceptor } from './interceptor/custom-request.interceptor';
import { MainComponent } from './main/main.component';
import { SearchBarComponent } from './search-bar/search-bar.component';
import { BucketNameService } from './service/bucket-name.service';


/** function to instantiate the application */
Expand Down Expand Up @@ -82,7 +83,8 @@ export function appInitFactory(appInitializerService: AppInitializerService): ()
{ provide: CoreConfigService, useClass: AppConfigService },
{ provide: LOCALE_ID, useFactory: (translate: TranslateService) => translate.currentLanguage, deps: [TranslateService] },
{ provide: HTTP_INTERCEPTORS, useClass: CustomRequestInterceptor, multi: true },
BsLocaleService
BsLocaleService,
{ provide: CoreBucketNameService, useClass: BucketNameService },
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
bootstrap: [AppComponent]
Expand Down
12 changes: 6 additions & 6 deletions projects/public-search/src/app/routes/documents-route.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ export class DocumentsRouteService extends BaseRoute implements ResourceRouteInt
intendedAudience: _('Intended audience'),
acquisition: _('Acquisition date'),
year: _('Publication year'),
subject_fiction: _('Subject (fiction)'),
subject_no_fiction: _('Subject (non-fiction)'),
subject: _('Subject'),
fiction: _('Fiction'),
},
showFacetsIfNoResults: true,
aggregationsOrder: this.aggregations(viewcode),
Expand Down Expand Up @@ -216,9 +216,9 @@ export class DocumentsRouteService extends BaseRoute implements ResourceRouteInt
_('language'),
_('year'),
_('author'),
_('subject_no_fiction'),
_('subject_fiction'),
_('subject'),
_('genreForm'),
_('fiction'),
_('intendedAudience'),
_('acquisition'),
_('status')
Expand All @@ -230,9 +230,9 @@ export class DocumentsRouteService extends BaseRoute implements ResourceRouteInt
_('language'),
_('year'),
_('author'),
_('subject_no_fiction'),
_('subject_fiction'),
_('subject'),
_('genreForm'),
_('fiction'),
_('intendedAudience'),
_('acquisition'),
_('status')
Expand Down

0 comments on commit 215c31f

Please sign in to comment.