Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sorting by last modified not working #172

Closed
feng1st opened this issue Jul 2, 2020 · 15 comments
Closed

sorting by last modified not working #172

feng1st opened this issue Jul 2, 2020 · 15 comments

Comments

@feng1st
Copy link

feng1st commented Jul 2, 2020

sorting by last modified seems not working, the actual order is changing every time i open the app or click one note then back to the all notes view.
lots of my notes have the same modified time in yaml header (manually edited when i first import from another app), maybe it's related to this issue.

@vHanda
Copy link
Contributor

vHanda commented Jul 3, 2020

Hey Feng.

Just to confirm. Two notes with the exact same modified: <date> value in the YAML header are being randomly sorted, but if the modified date is different, then is it working?

@feng1st
Copy link
Author

feng1st commented Jul 5, 2020

Hey Feng.

Just to confirm. Two notes with the exact same modified: <date> value in the YAML header are being randomly sorted, but if the modified date is different, then is it working?

if two notes with exact same modified date, not only the order between themselves are random, the order between them and other notes seems also random.

@vHanda
Copy link
Contributor

vHanda commented Jul 28, 2020

Could you please provide me with a small test case to reproduce this? I tried the following, and the sorting worked -

1.md

---
created: 2020-06-28T07:51:55+02:00
modified: 2020-06-28T07:52:00+02:00
---

1.md - earliest created/modified

2.md

---
created: 2020-07-28T07:51:55+02:00
modified: 2020-07-28T07:52:00+02:00
---

2.md - same metadata as 3.md

3.md

---
created: 2020-07-28T07:51:55+02:00
modified: 2020-07-28T07:52:00+02:00
---

3.md - same metadata as 2.md

4.md

4.md - no metadata

The sorted order was 2.md, 3.md, 1.md, 4.md, which seems correct to me.

@bgwwg
Copy link

bgwwg commented Aug 13, 2020

Can we sort notes by file date rather than the "last modfied" tag created in the YAML header?

@samuelyeewl
Copy link

How does the app currently sort files with no metadata? It would be nice to be able to use the file modification date (or commit in which it was last modified) to sort.

@vHanda
Copy link
Contributor

vHanda commented Sep 3, 2020

How does the app currently sort files with no metadata? It would be nice to be able to use the file modification date (or commit in which it was last modified) to sort.

Right now, it uses the modified time on the filesystem. Could you please vote on #78 ?

@ovichiro
Copy link

ovichiro commented Sep 5, 2020

How does the app currently sort files with no metadata? It would be nice to be able to use the file modification date (or commit in which it was last modified) to sort.

Right now, it uses the modified time on the filesystem. Could you please vote on #78 ?

Sorting by "Last modified" doesn't seem to work when YAML headers are disabled in app version 1.68. Doesn't seem to be using filesystem timestamp. The only use case I can see for git timestamps is preserving "last modified date" on a fresh reinstall, which to my mind is a rare event.

Edit: Some notes still have headers, even though they're not displayed. Regardless, the notes that don't have headers just stay put. They don't get reordered when changed.

@vHanda
Copy link
Contributor

vHanda commented Nov 9, 2020

I'm not sure what to do about this issue.

I can reproduce it at all :( If someone could provide a test case, that would really help.

@huy-vuong
Copy link

I see this happening for me too:

  1. I added a new note in Markdown using Foam, but it's the same repo as what I have GitJournal pointed to.
    • I have no dates in the frontmatter; just tags.
    • I've been updating this note most recently, so it has the most recent Last Modified timestamp of all of my notes.
  2. I refresh GitJournal to make sure the new note is present.
  3. I set sorting to Last Modified and Descending.
  4. All of my notes that don't have frontmatter modified fields are sorted in alphabetical order. Basically, order looks like:
    1. Most recent to least recent, according to the modified field in the frontmatter.
    2. Alphabetical order.

@plandrem
Copy link

plandrem commented Jul 6, 2021

Same issue here - no YAML headers, sorting is alphabetical. I submitted a bug report through the app.

@vHanda vHanda closed this as completed in f5ffebe Jul 7, 2021
@YodaEmbedding
Copy link

YodaEmbedding commented Jul 31, 2021

This happens for me upon the first time I open the app to All Notes. Going to a different folder and then back fixes it. What I see:

no date
no date
no date
2021-06-31
2021-06-30
2021-06-29
2021-06-27
...

@vHanda
Copy link
Contributor

vHanda commented Jul 31, 2021

@YodaEmbedding : Does changing the folder view type (grid/journal/card/normal) make a difference?

@YodaEmbedding
Copy link

YodaEmbedding commented Jul 31, 2021

Nope. I was using Standard view, FWIW. It also only seems to occur for Date Modified sort.

Possibly related: only a small portion of notes are loaded initially. Switching to a different folder and then back fixes it as well.

@vHanda
Copy link
Contributor

vHanda commented Jul 31, 2021

My original theory was that the notes are not fully loaded and even though the views are supposed to update themselves when the note has finished loading, that wasn't working.

If changing the view doesn't fix it, then the problem is in another layer. For the "All Notes" screen GitJournal creates a "virtual folder" which combines the contents of all the folders. Maybe that layer isn't propagating the signals properly. I'm not sure how to proceed.

If I could reproduce this, it would be trivial.

@vHanda vHanda reopened this Jul 31, 2021
@YodaEmbedding
Copy link

YodaEmbedding commented Jul 31, 2021

Reproduction steps:

  1. Clone this repository in the android app: https://github.com/YodaEmbedding/gitjournal-test
  2. Set "Home Screen" to "All Notes".
  3. Sort by "Last modified, descending".
  4. Kill android app.
  5. Start android app.

Actual result:

b
d modified
e
c
a

Expected result:

d modified
a
b
c
d

Directory structure:

Available on https://github.com/YodaEmbedding/gitjournal-test, but for future-proofing, written below:

dir1/
  a.md
  b.md
dir2/
  c.md
  d.md  (has modified tag)
  e.md

@vHanda vHanda closed this as completed in f24740e Aug 9, 2021
vHanda added a commit that referenced this issue Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants