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

Articles should be ordered by pubdate when saving them to the database #51

Closed
1 task done
freijon opened this issue Nov 10, 2016 · 15 comments
Closed
1 task done

Comments

@freijon
Copy link

freijon commented Nov 10, 2016

Explain the Problem

The list of entries in a group is not sortable by time. It's possible to sort an individual news feed (e.g. newest on top), but as soon as I click on the group to display all feeds in that group, the order gets mixed up.

Steps to Reproduce

  1. Sort all feeds inside a group to be 'newest first'
  2. View the parent group and notice that the order is mixed up instead of newest first for all feeds inside that group

System Information

  • News app version: 9.0.4
  • Nextcloud version: 10.0.1
  • PHP version: 7.0.12
  • Database and version: mysql 10.1.18
  • Browser and version: Tried with several browsers
  • Distribution and version: ArchLinuxARM

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@BernhardPosselt
Copy link
Member

Also works as expected. Articles are sorted by date added and not by their given published date because there are issues with pagination.

The issue is only present the first time you use the app

owncloud-archive/news#836

@freijon
Copy link
Author

freijon commented Nov 10, 2016

I can not confirm that it's working as expected. The sorting is also mixed
up with new articles (after the initial import), not only imported ones.

On Thu, Nov 10, 2016 at 9:35 AM Bernhard Posselt [email protected]
wrote:

Also works as expected. Articles are sorted by date added and not by their
given published date because there are issues with pagination.

The issue is only present the first time you use the app

owncloud-archive/news#836 owncloud-archive/news#836


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#51 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABUtN0szpJ_JT8CGqDKmYLNQS7rgjQYjks5q8tdSgaJpZM4KuVGG
.

@BernhardPosselt
Copy link
Member

BernhardPosselt commented Nov 10, 2016

They should be in order when they were added. Ordering is done by id which is an auto increment when things are added. So there might be slight differences depending on if the feed reports a wrong date or when articles are added faster than in a different feed.

Again, works as expected ;)

@BernhardPosselt
Copy link
Member

Please read up on the linked issues if you still disagree

@BernhardPosselt
Copy link
Member

BernhardPosselt commented Nov 10, 2016

TL;DR: Changes required for fixing this issue are basically the following:

  • Use 128bit Integers (we lack the hardware) to do this on a database level
  • Get rid of autopaging which will significantly slow down the web interface since everything has to be loaded when changing feeds rather than loading it on demand

@freijon
Copy link
Author

freijon commented Nov 11, 2016

I will continue to test the behavior in the next couple of days, but the
sorting keeps getting mixed up by several hours or even days in some cases:

11-11-2016 11-29-46

On Thu, Nov 10, 2016 at 1:34 PM Bernhard Posselt [email protected]
wrote:

TL;DR: Changes required for fixing this issue are basically the following:

  • Use 128bit Integers (we lack the hardware) to do this on a database
    level
  • Get rid of autopaging which will significantly slow down the web
    interface


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#51 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABUtNzN0uiPgxpPl0MJps3YYwSZNPPTEks5q8w9wgaJpZM4KuVGG
.

@BernhardPosselt
Copy link
Member

Would be interesting if you could provide example feeds. The image was not appended btw

@freijon
Copy link
Author

freijon commented Nov 11, 2016

@BernhardPosselt
Copy link
Member

Reason is that google does not publish the articles in order when they were released. A sort by pubdate should work before the loop is being run here https://github.com/nextcloud/news/blob/master/lib/Service/FeedService.php#L238

@BernhardPosselt
Copy link
Member

FYI this wont fix the "group" ordering but ordering them by pubdate is probably a good idea when adding new feeds

@BernhardPosselt BernhardPosselt changed the title Sorting of groups does not work Articles should be ordered by pubdate when saving them to the database Nov 11, 2016
@BernhardPosselt
Copy link
Member

The reverse loop can be dropped in favor of a foreach loop.

http://php.net/manual/en/function.usort.php can be used to compare items by their pubdate, probably similar to this:

usort($items, function ($a, $b) { 
    return ($a->getPubDate() < $b->getPubDate()) ? -1 : 1; 
}); 

@Peque
Copy link

Peque commented Jan 18, 2018

@BernhardPosselt Any updates on this matter? 😊

@BernhardPosselt
Copy link
Member

@Peque yeah, I stopped maintaing the app.

@Peque
Copy link

Peque commented Apr 28, 2021

@SMillerDev Has this been fixed?

Otherwise, if it is not considered a bug, could you simply replace the bug tag with a feature request tag and reopen? 😊

@SMillerDev
Copy link
Contributor

Nothing of the original code remains in 15.4, if this issue is still showing a new report should be made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants