@studyportals/fawkes 8.0.2-0 → 8.0.2-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,7 +28,6 @@ export class ProgrammesBaseIndexabilityPolicy extends BaseSeoIndexabilityPolicy
28
28
  else {
29
29
  result = await rule.forSitemapGenerator(filterKeyValues);
30
30
  }
31
- // console.log("RuleName: " + rule.getName() + " Rule result: " + result); // eslint-disable-line
32
31
  if (!result) {
33
32
  return false;
34
33
  }
@@ -4,11 +4,12 @@ import { SingleValueSelectedForFilterRule } from '../../common/rules/SingleValue
4
4
  import { FilterCombinations } from '../../enums/FilterCombinations';
5
5
  import { ProgrammesBaseIndexabilityPolicy } from '../ProgrammesBaseIndexabilityPolicy';
6
6
  import { IProgrammeSeoDependencies } from '../types/IProgrammeSeoDependencies';
7
+ import { PartTimeFormatRule } from '../rules/PartTimeFormatRule';
7
8
  export declare class ContinentFormat extends ProgrammesBaseIndexabilityPolicy {
8
9
  readonly name: string;
9
10
  readonly description: string;
10
11
  readonly filterKeys: FilterKey[];
11
- protected readonly rules: (SingleValueSelectedForFilterRule | OnlyFiltersSelectedRule)[];
12
+ protected readonly rules: (SingleValueSelectedForFilterRule | OnlyFiltersSelectedRule | PartTimeFormatRule)[];
12
13
  constructor(dependencies: IProgrammeSeoDependencies);
13
14
  protected generateUrls(): Promise<string[]>;
14
15
  get filterCombination(): FilterCombinations;
@@ -5,6 +5,7 @@ import { FilterCombinations } from '../../enums/FilterCombinations';
5
5
  import { ProgrammesBaseIndexabilityPolicy } from '../ProgrammesBaseIndexabilityPolicy';
6
6
  import { ContinentPresenter } from '../../presenters/ContinentPresenter';
7
7
  import { FormatPresenter } from '../../presenters/FormatPresenter';
8
+ import { PartTimeFormatRule } from '../rules/PartTimeFormatRule';
8
9
  export class ContinentFormat extends ProgrammesBaseIndexabilityPolicy {
9
10
  name = 'Continent Format Policy';
10
11
  description = 'Determines indexing rules for pages filtered by continent and format.';
@@ -13,6 +14,7 @@ export class ContinentFormat extends ProgrammesBaseIndexabilityPolicy {
13
14
  new SingleValueSelectedForFilterRule(FilterKey.ATTENDANCE),
14
15
  new SingleValueSelectedForFilterRule(FilterKey.CONTINENT),
15
16
  new OnlyFiltersSelectedRule([FilterKey.ATTENDANCE, FilterKey.CONTINENT]),
17
+ new PartTimeFormatRule()
16
18
  ];
17
19
  constructor(dependencies) {
18
20
  super(dependencies);
@@ -1,4 +1,4 @@
1
- import { FilterKey } from '@studyportals/search-filters/server-side';
1
+ import { FilterKey, FormatFilterOptionValue } from '@studyportals/search-filters/server-side';
2
2
  import { OnlyFiltersSelectedRule } from '../../common/rules/OnlyFiltersSelectedRule';
3
3
  import { SingleValueSelectedForFilterRule } from '../../common/rules/SingleValueSelectedForFilterRule';
4
4
  import { FilterCombinations } from '../../enums/FilterCombinations';
@@ -23,8 +23,7 @@ export class DegreeFormat extends ProgrammesBaseIndexabilityPolicy {
23
23
  async generateUrls() {
24
24
  const formatFragments = FormatPresenter.getInstance().getFragments();
25
25
  const degreeFragments = DegreePresenter.getInstance().getFragments();
26
- // Only allow fulltime and parttime formats for degree combinations
27
- const allowedFormatIds = ["fulltime", "parttime"];
26
+ const allowedFormatIds = [FormatFilterOptionValue.PART_TIME, FormatFilterOptionValue.FULL_TIME];
28
27
  const allowedFormats = formatFragments.filter(format => allowedFormatIds.includes(format.id));
29
28
  const paths = [];
30
29
  for (const pageNumber of this.indexablePageNumbers) {
@@ -1,4 +1,5 @@
1
1
  import { DependencyMissingError } from '../../errors/DependencyMissingError';
2
+ import { FilterKey } from '@studyportals/search-filters/server-side';
2
3
  export class MinimumAmountOfResultsRule {
3
4
  minimumResultsCount = 7;
4
5
  maximumPageSize = 20;
@@ -16,6 +17,11 @@ export class MinimumAmountOfResultsRule {
16
17
  throw new DependencyMissingError('SearchApiClient');
17
18
  }
18
19
  const count = await this.searchApiClient.getCount(filterKeyValues);
20
+ if (Object.keys(filterKeyValues).includes(FilterKey.DURATION) && Object.keys(filterKeyValues).length === 1) {
21
+ const filterKey = FilterKey.DURATION;
22
+ const filterValue = filterKeyValues.get(filterKey);
23
+ console.log(`DEBUG: Duration filter applied alone, filter: ${filterValue} found results: ${count}`); // eslint-disable-line no-console
24
+ }
19
25
  return count >= (pageNumber - 1) * this.maximumPageSize + this.minimumResultsCount;
20
26
  }
21
27
  forSitemapGenerator() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studyportals/fawkes",
3
- "version": "8.0.2-0",
3
+ "version": "8.0.2-2",
4
4
  "description": "A package to centralize SEO related logic for SBLP and Sitemap Generator.",
5
5
  "files": [
6
6
  "./dist"