Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve config names #1049

Merged
merged 2 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"test:coverage": "yarn run -T vitest run --coverage --colors",
"test:watch": "yarn run -T vitest watch",
"type-check": "yarn run -T tsc --noEmit",
"update-game-popularity": "NODE_ENV=development tsx src/test/scripts/testUpdateGamePopularity.ts",
"update-popularity": "NODE_ENV=development tsx src/test/scripts/testUpdateProgramItemPopularity.ts",
"verify-results": "NODE_ENV=development tsx src/test/scripts/testVerifyResults.ts",
"load-kompassi-data": "NODE_ENV=development tsx src/test/scripts/loadKompassiDataToDb.ts",
"update-kompassi-datadump": "NODE_ENV=development tsx src/test/scripts/updateKompassiDataDump.ts",
Expand Down
4 changes: 2 additions & 2 deletions server/src/features/assignment/padg/utils/assignPadg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ export const assignPadg = (
list: ListItem[],
updateL: (input: Input) => string,
): PadgRandomAssignResult[] => {
const { PADG_ASSIGNMENT_ROUNDS } = config.server();
const { padgAssignmentRounds } = config.server();

let finalHappiness = 0;
let finalAssignResults: PadgRandomAssignResult[] = [];

for (let i = 0; i < PADG_ASSIGNMENT_ROUNDS; i++) {
for (let i = 0; i < padgAssignmentRounds; i++) {
const eventsCopy = cloneDeep(events);

const input: PadgInput = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ export const runRandomAssignment = (
const list = unwrapResult(listResult);
const updateL = (input: RandomAssignUpdateLInput): ListItem[] => input.L;

const { RANDOM_ASSIGNMENT_ROUNDS } = config.server();
const { randomAssignmentRounds } = config.server();
const input = {
groups,
events,
L: list,
updateL,
assignmentRounds: RANDOM_ASSIGNMENT_ROUNDS,
assignmentRounds: randomAssignmentRounds,
};

let assignResults: AssignmentElement[] | CheckResult | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const getRandomLotterySignup = (

// Select random program items for each start time
firstFourTimes.forEach((startTime) => {
logger.debug(`Generate signups for time ${startTime}`);
logger.debug(`Generate lottery signups for time ${startTime}`);
const programItemsForTime = activeProgramItems.filter(
(activeProgramItem) =>
dayjs(activeProgramItem.startTime).toISOString() ===
Expand Down
16 changes: 8 additions & 8 deletions shared/config/serverConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export interface ServerConfig {
jwtSecretKeyAdmin: string;
jwtSecretKeyHelp: string;
allowedCorsOrigins: readonly string[];
PADG_ASSIGNMENT_ROUNDS: number;
RANDOM_ASSIGNMENT_ROUNDS: number;
padgAssignmentRounds: number;
randomAssignmentRounds: number;
bundleCompression: boolean;
autoUpdateProgramEnabled: boolean;
programUpdateInterval: string;
Expand Down Expand Up @@ -85,8 +85,8 @@ const prodConfig = {
jwtSecretKeyHelp: process.env.JWT_SECRET_KEY_HELP ?? "",
allowedCorsOrigins: getAllowedCorsOrigins(),
debug: process.env.DEBUG === "true" || false,
PADG_ASSIGNMENT_ROUNDS: 300,
RANDOM_ASSIGNMENT_ROUNDS: 300,
padgAssignmentRounds: 300,
randomAssignmentRounds: 300,
consoleLogFormatJson: true,

// Dev
Expand All @@ -113,8 +113,8 @@ const stagingConfig = {
jwtSecretKeyHelp: process.env.JWT_SECRET_KEY_HELP ?? "",
allowedCorsOrigins: getAllowedCorsOrigins(),
debug: process.env.DEBUG === "true" || false,
PADG_ASSIGNMENT_ROUNDS: 300,
RANDOM_ASSIGNMENT_ROUNDS: 300,
padgAssignmentRounds: 300,
randomAssignmentRounds: 300,
consoleLogFormatJson: true,

// Dev
Expand Down Expand Up @@ -147,8 +147,8 @@ const devConfig = {
"http://server:5000",
]),
debug: false,
PADG_ASSIGNMENT_ROUNDS: 300,
RANDOM_ASSIGNMENT_ROUNDS: 10,
padgAssignmentRounds: 300,
randomAssignmentRounds: 10,
consoleLogFormatJson: false,

// Dev
Expand Down