Prayer journal: pinning, waiting/partial status, import, dashboard card
Build and Push Docker Image / build-and-push (push) Successful in 5m14s
Build and Push Docker Image / build-and-push (push) Successful in 5m14s
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6d647e8d8a
commit
1cf157be64
10 files changed
+365
-22
No files matched your search
@@ -28,6 +28,9 @@ export function cleanPrayer(raw, now = Date.now()) {
|
||||
createdAt: time(raw.createdAt, updatedAt), updatedAt,
|
||||
answeredAt: Number.isFinite(raw.answeredAt) && raw.answeredAt > 0 ? raw.answeredAt : null,
|
||||
answerNote: text(raw.answerNote, 1000).trim(),
|
||||
status: raw.status === 'waiting' || raw.status === 'partial' ? raw.status : '',
|
||||
pinned: raw.pinned === true,
|
||||
rank: int(raw.rank, 0, 100_000) ? raw.rank : null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -37,3 +37,8 @@ test('a deleted prayer is not brought back by an older copy, and old markers are
|
||||
test('open prayers are the ones not answered or deleted', () => {
|
||||
expect(openPrayers([p('a'), p('b', { answeredAt: NOW }), { id: 'c', deleted: true, updatedAt: 1 }]).map((x) => x.id)).toEqual(['a']);
|
||||
});
|
||||
|
||||
test('pin, rank and status are kept when valid and dropped when not', () => {
|
||||
expect(cleanPrayer(p('a', { pinned: true, rank: 2, status: 'partial' }), NOW)).toMatchObject({ pinned: true, rank: 2, status: 'partial' });
|
||||
expect(cleanPrayer(p('a', { pinned: 'yes', rank: -4, status: 'bogus' }), NOW)).toMatchObject({ pinned: false, rank: null, status: '' });
|
||||
});
|
||||
Reference in new issue
Block a user