21 lines
562 B
TypeScript
Executable File
21 lines
562 B
TypeScript
Executable File
export type ReflectionData = {
|
|
wentWell: string;
|
|
learned: string;
|
|
improveTomorrow: string;
|
|
};
|
|
|
|
export function hasMeaningfulReflectionContent(data: ReflectionData): boolean {
|
|
return [data.wentWell, data.learned, data.improveTomorrow].some(
|
|
(field) => field.trim().length > 0
|
|
);
|
|
}
|
|
|
|
export function shouldAwardReflectionXp(
|
|
existing: ReflectionData | null | undefined,
|
|
data: ReflectionData
|
|
): boolean {
|
|
if (!hasMeaningfulReflectionContent(data)) return false;
|
|
if (!existing) return true;
|
|
return !hasMeaningfulReflectionContent(existing);
|
|
}
|