in2code-de / publications

Follower of EXT:bib to show publications in TYPO3. Im- and export of bibtext and xml files.

Home Page:https://www.in2code.de/agentur/typo3-extensions/publications/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Order problem within groups

nannione opened this issue · comments

commented

If i choose the group 'year' for the frontend view, what is the order within the year groups? I would think publications should be sorted by title within each year but somehow the lists seem to be of random order...? I found no way to fix this.

The current situation in the extension is:
You can set a "group by" definition in the FlexForm (year 0, type 1, year+type 2).

The ordering is related to this settings and you can see it here:
https://github.com/in2code-de/publications/blob/develop/Classes/Domain/Model/Dto/Filter.php#L161

This means, that if you have chosen "year" for your group by, the output is filtered by year and after that by title.

commented

My 'group by' setting was 'year [0]' and i already checked the lines you mentioned before....

Here is how you can recreate the unsorted titles within the year groups: Select in the plugin the setting "empty = all" for the publication status (better name would publication type, or?). The titles are unsorted and if you have not assigned any publication type in each publication, the titles will not show up at all (that could be the reason why some people see nothing in the front end). I use version 2.1.0 and TYPO3 9.5.x.

I re-checked the code and the history and my comment (see above) is simply wrong - sorry for this.
At first we ordered as described (that was the code: https://github.com/in2code-de/publications/blob/develop/Classes/Domain/Model/Dto/Filter.php#L161) but a bit later @kfumy requested a new feature: We sort publications now by date of a publication (within a year).
Date is a bit tricky because bib does not support a valid date format but values in fields year, month and day.
So if month or day is empty, we always assume the first day of january for the publication. Then it might look like randomized output.


Techical notes:

commented

No need to apologize, my assumption in the previous comment was not true as well.

To get a sorted list by title within year groups (if day and month are not set) can be done by removing line
https://github.com/in2code-de/publications/blob/develop/Classes/Domain/Repository/PublicationRepository.php#L308
Thank you.

I don't understand your latest request. The code line 309 is related to a comment.

commented

Sorry, it is line 308 not 309, i changed it now.

Ok, but this will remove the sorting by date. We can't change this as you wrote.
Or do you mean that is "your" solution and you are fine with it?

commented

Yes, certainly just my solution for my special case (and maybe for anyone who runs into the same problem if day and month are not set in publications).

Thx for your final feedback and have a nice day

commented

You too, sorry for any confusion, it is 45°C here, hard to think straight.