mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-09 19:22:51 +00:00
refactor: add dynamic semester boostings
This commit is contained in:
@@ -22,6 +22,22 @@ export function inRangeInclusive(num: number, range: number[]): boolean {
|
||||
return num >= range[0] && num <= range[1];
|
||||
}
|
||||
|
||||
const sommerRange = [4, 9];
|
||||
const winterRange = [10, 3];
|
||||
const month = new Date().getMonth();
|
||||
const year = new Date().getFullYear();
|
||||
const winterYearOffset = (month < winterRange[0] ? -1 : 0);
|
||||
const sommerYear = year + (month <= winterRange[1] ? -1 : 0);
|
||||
const winterYear = `${year + winterYearOffset}/${(year + 1 + winterYearOffset)
|
||||
.toString()
|
||||
.slice(-2)}`;
|
||||
|
||||
const wsAcronymShort = `WS ${winterYear}`;
|
||||
const ssAcronymShort = `SS ${sommerYear}`;
|
||||
const wsAcronymLong = `WiSe ${winterYear}`;
|
||||
const ssAcronymLong = `SoSe ${sommerYear}`;
|
||||
|
||||
|
||||
const userGroupSetting: SCUserGroupSetting = {
|
||||
categories: ['profile'],
|
||||
defaultValue: 'students',
|
||||
@@ -430,6 +446,19 @@ const config: Partial<SCConfigFile> = {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: 'search',
|
||||
route: '/hebis-search',
|
||||
title: 'library catalog',
|
||||
translations: {
|
||||
de: {
|
||||
title: 'Bibliothekskatalog',
|
||||
},
|
||||
en: {
|
||||
title: 'library catalog',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: 'folder',
|
||||
route: '/catalog',
|
||||
@@ -471,6 +500,19 @@ const config: Partial<SCConfigFile> = {
|
||||
icon: 'person',
|
||||
id: 'personal',
|
||||
items: [
|
||||
{
|
||||
icon: 'library',
|
||||
route: '/library-account',
|
||||
title: 'library account',
|
||||
translations: {
|
||||
de: {
|
||||
title: 'Bibliothekskonto',
|
||||
},
|
||||
en: {
|
||||
title: 'library account',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: 'star',
|
||||
route: '/favorites',
|
||||
@@ -713,8 +755,10 @@ const config: Partial<SCConfigFile> = {
|
||||
factor: 1,
|
||||
fields: {
|
||||
'academicTerms.acronym': {
|
||||
'SoSe 2022': 1.05,
|
||||
'WiSe 2021/2022': 1.1,
|
||||
[ssAcronymShort]: inRangeInclusive(month, sommerRange) ? 1.1 : 1.05,
|
||||
[wsAcronymShort]: inRangeInclusive(month, winterRange) ? 1.1 : 1.05,
|
||||
[ssAcronymLong]: inRangeInclusive(month, sommerRange) ? 1.1 : 1.05,
|
||||
[wsAcronymLong]: inRangeInclusive(month, winterRange) ? 1.1 : 1.05,
|
||||
},
|
||||
},
|
||||
type: SCThingType.AcademicEvent,
|
||||
|
||||
Reference in New Issue
Block a user