One can reorder items on the Challenges tab but the sort reverts.
EDIT by Alys 2020-05-13: Before working on this, please read the comments below and also the comments in this pull request: https://github.com/HabitRPG/habitica/pull/12021 . If you think the code in that PR is suitable for re-use in your solution, you're welcome to use it - please mention in your PR that you've done so.
EDIT by Alys 2017: This issue will be easier to fix now because there is code for sorting tasks in Group Plans (#8358) and it can be reused for challenges. Copying from @TheHollidayInn's comment below:
"the code allows to order challenge tasks (and can be shared between all three). Although, there needs to be a taskOrder object on the challenge - not sure if that exists."
EDIT by Alys 2020-02-28: What's supposed to happen is that the order of the tasks you see on the challenge's screen should be the same as the order of the task IDs in the challenge's tasksOrder object. Below is an example of that object in a challenge's document.
An additional problem is that the challenge's page has lost the ability for the challenge owner to reorder the tasks. The owner should be able to drag and drop in the same way that a user can drag and drop their own tasks. Admins (moderators and staff) should also be able to drag and drop the challenge's tasks (there's already code for challenges that gives admins the same rights at the challenge owner). Other players should not be able to drag a challenge's tasks in the challenge's own page (of course they can drag their own copies of the tasks after they join the challenge).
{
"_id": "b7fbd6a2-6d5e-4f28-a81f-12f42f9cf447",
"tasksOrder": {
"habits": [
"990933b0-4853-4f38-92b0-3864ce576f9e",
"3d131996-768b-46e9-937d-993452a78df2",
"5ca7fbf1-b7b5-498e-9c6d-85d328a50099"
],
"dailys": [
"30ef773b-292e-46e7-beb1-ecf2df66cbb3",
"62782db7-8bbd-48e4-b0b0-2ab86a5d1031"
],
"todos": [
"85a5e240-8c64-446d-baab-db6debbabdd0",
"71a67058-e022-497a-8319-d52584383b66"
],
"rewards": [
"2c0f8ed9-a61f-4ba4-9ad4-5f36a25db02a"
]
},
"official": false,
"memberCount": 0,
"prize": 0,
"name": "My Challenge",
.... etc ....
}
I think this issue and the closed issue #5647 ("Cannot rearrange tasks when creating or editing a challenge.") are different issues (though related). One is about tasks changing order in one's personal tasks page after joining the challenge. The other is about not being able to reorder tasks in a challenge while editing. Those are/should be two different orders. (One of the tasks inside the challenge as you see them before you join, the other of your personal tasks after you've rearranged them into your own preferred order.)
I'd very much like to have the feature to reorder challenge tasks during challenge creation. It would save much work since now the only way to do it is to delete tasks and recreate them in the right order.
I just cloned a challenge, and the task order changed. So now you can't sort them when you create them, you can't sort them when you edit the challenge, and you can't rely on them staying sorted when you clone the challenge. :(
The challenge I cloned was created before the change to API v3. (I'm not sure if that makes a difference but I thought I'd mention it. I haven't tested it with newer challenges.)
I did some testing about this in the Challenge Sandbox guild. Please read the (looong) description of the challenge :bug: Bug Test Challenge 1: Testing Various Task Order Bugs for details!
To sum things up:
Those are definitely bugs. (Ok, the last one is rather a missing feature.) So, is there no workaround? Yes, there is! (At least it has worked so far...)
(Of course, you could always just simply number the tasks and leave it to each participant to sort them in their own Tasks page...)
Also, please don't confuse this bug with other bugs! (For example, issue 7599 (challenge tasks are in wrong order in one's own Tasks page directly after joining, creating, or cloning), or issue 7645 (when sorting tasks in one's own Tasks page, the order isn't saved properly, or changes unexpectedly).)
This issue might be easier to fix now because there is code for sorting tasks in Group Plans: https://github.com/HabitRPG/habitica/pull/8358
It's possible that the code could be reused or copied for challenges. Or I might be completely wrong. :) It's probably worth a look though.
Yep, the code allows to order challenge tasks (and can be shared between all three). Although, there needs to be a taskOrder object on the challenge - not sure if that exists.
This is definitely still an issue so I'm reopening it. Note the comments above from me and TheHollidayInn from January 2017 about sorting. tasksOrder does exist in challenges, for example:
{
"_id": "21aacfa4-3eea-4d64-9cfe-efc3c60a034d",
...
"tasksOrder": {
"rewards": [],
"todos": [
"d5cb42b1-e7d2-4977-b2e1-5dbfde9d6a67",
"ce4e18cc-7c76-4342-bfd2-d08cff01325b",
"17cb44ff-5839-4f5e-a1f2-33159fe25a8a",
"5111b729-4eba-42f9-b74a-c6a6c0656efb"
],
"dailys": [],
"habits": []
},
...
}
This is about challenge tasks not keeping the same order when added to the user's list? So it's different from the issue @SabreCat reported?
This one is about the challenge owner editing the challenge to sort the tasks on the challenges page (basically the same as #10464). https://github.com/HabitRPG/habitica/issues/7599 is for tasks keeping the same order when first added to the user's list.
It looks like this isn't an issue anymore. Should it be closed?
It is still an issue. What's supposed to happen is that the order of the tasks you see on the challenge's screen should be the same as the order of the task IDs in the challenge's tasksOrder object. Below is an example of that object in a challenge's document. (What seems to happen currently is that the tasks stay in a fixed order, but it's not the order they're meant to be in.)
However I've realised that the challenge's page has lost the ability for the challenge owner to reorder the tasks. They should be able to drag and drop in the same way that a user can drag and drop their own tasks. Admins (moderators and staff) should also be able to drag and drop the challenge's tasks (there's already code for challenges that gives admins the same rights at the challenge owner). Other players should not be able to drag a challenge's tasks.
I'll update the top post with this information since dragging-and-dropping should be implemented at the same time as obeying the tasksOrder object.
{
"_id": "b7fbd6a2-6d5e-4f28-a81f-12f42f9cf447",
"tasksOrder": {
"habits": [
"990933b0-4853-4f38-92b0-3864ce576f9e",
"3d131996-768b-46e9-937d-993452a78df2",
"5ca7fbf1-b7b5-498e-9c6d-85d328a50099"
],
"dailys": [
"30ef773b-292e-46e7-beb1-ecf2df66cbb3",
"62782db7-8bbd-48e4-b0b0-2ab86a5d1031"
],
"todos": [
"85a5e240-8c64-446d-baab-db6debbabdd0",
"71a67058-e022-497a-8319-d52584383b66"
],
"rewards": [
"2c0f8ed9-a61f-4ba4-9ad4-5f36a25db02a"
]
},
"official": false,
"memberCount": 0,
"prize": 0,
"name": "My Challenge",
.... etc ....
}
I've created a PR! https://github.com/HabitRPG/habitica/pull/12021
Hi @alecbrick, are you still working on this one? :) If I don't hear back, I'll set this back to "help wanted" in about a week.
@alecbrick I'm setting this issue back to help wanted, but if you want to pick it back up, let us know!
I've removed some old comments that are no longer relevant and updated the top post to mention that a contributor should review the other comments here and in https://github.com/HabitRPG/habitica/pull/12021
Ideally we should collate all the comments from both sources and purge anything irrelevant to make this easier to pick up. :-/ If I can find time I might do that.
I'm going to take over that PR, it was almost done and contains a lot of good refactoring, I'll try to finish it this or next week
I checked again today - and when cloning a challenge, the cloned challenge still has a different (apparently randomly mixed up) task order than the original challenge.
(Today I also deleted my "Bug Test Challenge 1" from 2016 that I linked to in a previous comment. Most of the detailed test description in that challenge was obsolete and useless by now.)
Thanks for the update! I don't think a fix has actually been completed for this anyway, so it would be expected that things are still not working that way... is that right, @paglias?
@habitrpguser this is still open indeed! We have a quite complete PR at https://github.com/HabitRPG/habitica/pull/12204 and if you could finish the remaining issues it would be great!
Most helpful comment
I'm going to take over that PR, it was almost done and contains a lot of good refactoring, I'll try to finish it this or next week