#23 - support for sorting by metadata

- code comments update
This commit is contained in:
SebastianMC 2022-11-09 18:53:51 +01:00
parent 10bf6e42c7
commit c983c479f0
1 changed files with 0 additions and 6 deletions

View File

@ -238,14 +238,8 @@ export const determineSortingGroup = function (entry: TFile | TFolder, spec: Cus
// - else, if withMetadata field name is defined for the group -> use it. Done even if value empty or not present. // - else, if withMetadata field name is defined for the group -> use it. Done even if value empty or not present.
// - otherwise, fallback to the default metadata field name (hardcoded in the plugin as 'sort-index-value') // - otherwise, fallback to the default metadata field name (hardcoded in the plugin as 'sort-index-value')
// TODO: in manual of plugin, in details, explain these nuances. Let readme.md contain only the basic simple example and reference to manual.md section // TODO: in manual of plugin, in details, explain these nuances. Let readme.md contain only the basic simple example and reference to manual.md section
// One of nuances: if metadata value is not present or empty -> is this treated same or not?
// Other nuance: the fallback to compare titles -> exactly when (I suspect when there are no metadata or empty values. Because if one item has some metadata value and the other doesn't have any, the one with the metadata value goes first (for alphabetical) or goes last (for alphabetical reverse) - maybe in both cases should go last?
//
// I should probably write a test for this specific comparator
if (determined && determinedGroupIdx !== undefined) { // <-- defensive code, maybe too defensive if (determined && determinedGroupIdx !== undefined) { // <-- defensive code, maybe too defensive
const group: CustomSortGroup = spec.groups[determinedGroupIdx]; const group: CustomSortGroup = spec.groups[determinedGroupIdx];
if (isByMetadata(group?.order)) { if (isByMetadata(group?.order)) {