MarckFp / ppoc-gen

PPOC Gen, it's a web application in charge of managing the schedules and turns for the public preaching of the Jehovah's witnesses
https://ppocgen.com
Apache License 2.0
0 stars 0 forks source link

Feature to make it possible to order people by lastname instead of firstname #34

Closed MarckFp closed 5 months ago

KartikChinda commented 5 months ago

Hey @MarckFp , I am new to Ts and Open source contributions, so I might not be entirely correct in understanding the codebase as a whole, but I believe just changing the first-name to last-name in the order-by function call should do the trick? (This is in src/routes/publishers/page) image

MarckFp commented 5 months ago

Thanks for the suggestion @KartikChinda !

It is indeed needed to change the sorting order of the IndexedDB query. We need also to change in the view the order of the columns in the table at showing the publishers. Also I would like to add that setting con the congregation settings so we need to add a new field at the congregation table.

Probably this is going to be done on Monday! Thanks for the help and feedback!

KartikChinda commented 5 months ago

Ah yes, that makes sense. Thank you for this comment, it helps me understand the codebase better and see all the changes that would be necessary for this step. I will be on the lookout for other good-first-issues I can solve in this repository (hopefully my learning enhances to help me do that soon haha). buenos dias!

MarckFp commented 5 months ago

Hi @KartikChinda! As you can see in this PR (https://github.com/MarckFp/ppoc-gen/pull/38) I've already implemented ordering by last name. Also, I've added a few improvements like preventing retrieving the congregation as an array when it's always going to be only 1 congregation.

Unfortunately, I've seen a bug that I'm trying to solve. Affinities are listed correctly with publishers having last name before first name but the first record retrieved by Dexie is ordered in a wrong way

MarckFp commented 5 months ago

Here is a screenshot to understand what's the issue

image

MarckFp commented 5 months ago

I'm going to merge the PR but I'll keep this issue open until I find a solution

MarckFp commented 5 months ago

Fixed at https://github.com/MarckFp/ppoc-gen/commit/aa0c42e1ca9149daaa0659928868bfd35d6e2f06 !!!

Apparently not only the first item was not being ordered correctly, the full list was sorted incorrectly. Adding the affinityList to the onMount block fills the array in the correct order

KartikChinda commented 5 months ago

Yes, the image explains it very clearly. Once again, thanks a ton for explaining this perfectly. I have grasped what the issue was as well as how it has been fixed!