|
1 | 1 | // @flow |
2 | 2 | //----------------------------------------------------------------------------- |
3 | 3 | // Dashboard plugin main function to generate data |
4 | | -// Last updated 2025-04-01 for v2.2.0.a10, @jgclark |
| 4 | +// Last updated 2025-04-15 for v2.2.1, @jgclark |
5 | 5 | //----------------------------------------------------------------------------- |
6 | 6 |
|
7 | 7 | import moment from 'moment/min/moment-with-locales' |
@@ -547,33 +547,6 @@ export function getThisQuarterSectionData(config: TDashboardSettings, useDemoDat |
547 | 547 | // fa-calendar-days (same as quarter). This would be section #6 |
548 | 548 | //---------------------------------------------------------------- |
549 | 549 |
|
550 | | -/** |
551 | | - * Note: now not used, as core of it is now in getSomeSectionsData() above. This is because: |
552 | | - * 1. it is really just a wrapper around getTaggedSectionData() |
553 | | - * 2. this means multiple TAG sections can be returned as they are generated, rather than all at once, which feels more natural. |
554 | | - * Get the tagged sections for each tag - they will all be sectionCode=TAG |
555 | | - * sectionName will be the tag name, and showSettingName will be unique for this tag |
556 | | - * @param {TDashboardSettings} config |
557 | | - * @param {boolean} [useDemoData=false] |
558 | | - * @returns {Array<TSection>} |
559 | | - */ |
560 | | -// export function getTaggedSections(config: TDashboardSettings, useDemoData: boolean = false): Array<TSection> { |
561 | | -// const startTime = new Date() |
562 | | -// const tagSections = getTagSectionDetails(removeInvalidTagSections(config)) |
563 | | -// // clo(tagSections) |
564 | | -// // logInfo('getTaggedSections', `- after getTagSectionDetails: ${timer(startTime)}`) |
565 | | -// |
566 | | -// const output = tagSections.reduce((acc: Array<TSection>, sectionDetail: TSectionDetails, index: number) => { |
567 | | -// // $FlowIgnore[invalid-computed-prop] |
568 | | -// const showSettingForTag = config[sectionDetail.showSettingName] |
569 | | -// // logDebug('getTaggedSections', `sectionDetail.sectionName=${sectionDetail.sectionName} showSettingForTag=${showSettingForTag}`) |
570 | | -// if (typeof showSettingForTag === 'undefined' || showSettingForTag) acc.push(getTaggedSectionData(config, useDemoData, sectionDetail, index)) |
571 | | -// return acc // Return the accumulator |
572 | | -// }, []) |
573 | | -// logTimer('getTaggedSections', startTime, `at end`, 1500) |
574 | | -// return output |
575 | | -// } |
576 | | - |
577 | 550 | /** |
578 | 551 | * Generate data for a section for items with a Tag/Mention. |
579 | 552 | * Only find paras with this *single* tag/mention which include open tasks that aren't scheduled in the future. |
@@ -720,8 +693,10 @@ export async function getTaggedSectionData(config: TDashboardSettings, useDemoDa |
720 | 693 | config.overdueSortOrder === 'priority' |
721 | 694 | ? ['-priority', '-changedDate'] |
722 | 695 | : config.overdueSortOrder === 'earliest' |
723 | | - ? ['changedDate', 'priority'] |
724 | | - : ['-changedDate', 'priority'] // 'most recent' |
| 696 | + ? ['changedDate', '-priority'] |
| 697 | + : config.overdueSortOrder === 'due date' |
| 698 | + ? ['dueDate', '-priority'] |
| 699 | + : ['-changedDate', '-priority'] // 'most recent' |
725 | 700 | const sortedTagParas = sortListBy(dashboardParas, sortOrder) |
726 | 701 | logTimer('getTaggedSectionData', thisStartTime, `- Filtered, Reduced & Sorted ${sortedTagParas.length} items by ${String(sortOrder)}`) |
727 | 702 |
|
@@ -828,7 +803,13 @@ export async function getOverdueSectionData(config: TDashboardSettings, useDemoD |
828 | 803 |
|
829 | 804 | // Sort paragraphs by one of several options |
830 | 805 | const sortOrder = |
831 | | - config.overdueSortOrder === 'priority' ? ['-priority', '-changedDate'] : config.overdueSortOrder === 'earliest' ? ['changedDate', 'priority'] : ['-changedDate', 'priority'] // 'most recent' |
| 806 | + config.overdueSortOrder === 'priority' |
| 807 | + ? ['-priority', '-changedDate'] |
| 808 | + : config.overdueSortOrder === 'earliest' |
| 809 | + ? ['changedDate', '-priority'] |
| 810 | + : config.overdueSortOrder === 'due date' |
| 811 | + ? ['dueDate', '-priority'] |
| 812 | + : ['-changedDate', '-priority'] // 'most recent' |
832 | 813 | const sortedOverdueTaskParas = sortListBy(dashboardParas, sortOrder) |
833 | 814 | logDebug('getOverdueSectionData', `- Sorted ${sortedOverdueTaskParas.length} items by ${String(sortOrder)} after ${timer(thisStartTime)}`) |
834 | 815 |
|
|
0 commit comments