fix(journals): robust date sorting in journal and entry processors

This commit is contained in:
Scott Idem
2026-02-12 15:23:22 -05:00
parent c4009391c0
commit 60771c5ba1
2 changed files with 7 additions and 5 deletions

View File

@@ -205,7 +205,7 @@ export async function load_ae_obj_li__journal({
hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
limit?: number;
offset?: number;
order_by_li?: key_val;
order_by_li?: key_val; // Order by fields for the journal entries
params?: key_val;
try_cache?: boolean;
log_lvl?: number;
@@ -859,9 +859,10 @@ export async function process_ae_obj__journal_props({
obj.cfg_json = obj.cfg_json ?? {};
obj.data_json = obj.data_json ?? {};
const updated = obj.updated_on ?? obj.created_on ?? new Date(0).toISOString();
obj.tmp_sort_3 = `${obj.group ?? '0'}_${obj.priority ? 1 : 0}_${obj.sort ?? '0'}_${
obj.name
}_${obj.updated_on ?? obj.created_on}`;
}_${updated}`;
obj.combined_passcode = `${obj.passcode ?? ''}:${obj.private_passcode ?? ''}`;
return obj;

View File

@@ -1027,15 +1027,16 @@ export async function process_ae_obj__journal_entry_props({
// Journal entry-specific computed sort fields, overriding generic ones if needed
const sort_val = (obj.sort ?? 0).toString().padStart(3, '0');
const updated = obj.updated_on ?? obj.created_on ?? new Date(0).toISOString();
obj.tmp_sort_1 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${obj.updated_on ?? obj.created_on}`;
}_${updated}`;
obj.tmp_sort_2 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${obj.name ?? ''}_${obj.updated_on ?? obj.created_on}`;
}_${obj.name ?? ''}_${updated}`;
obj.tmp_sort_3 = `${obj.group ?? ''}_${obj.priority ? '1' : '0'}_${
sort_val
}_${obj.name ?? ''}_${obj.updated_on ?? obj.created_on}`;
}_${obj.name ?? ''}_${updated}`;
return obj;
}