habitica icon indicating copy to clipboard operation
habitica copied to clipboard

People joining the challenge are not appearing in the order they joined

Open cTheDragons opened this issue 8 years ago • 16 comments

General Info

bc10ec41-4213-4482-bbb8-558e3c3ea8d5 Opera 37.0.2178.43 Windows 8.1 32-bit

Description

In API2, you could determine when a user joined a challenge by the order they appear on the list. Now it is difficult to determine who are the late comers are, without keeping a list outside Habitica.

Thanks

cTheDragons avatar Jun 25 '16 12:06 cTheDragons

This feature (or any other feature that provides similar data) is important for judging how long a participant has been doing the challenge tasks and/or how quickly they have ticked off the To-Dos.

Alys avatar Jun 25 '16 12:06 Alys

The user's challenge tasks should have a dateCreated attribute which would be the date they joined the challenge. Might just be a matter of exposing that info.

crookedneighbor avatar Jun 25 '16 12:06 crookedneighbor

That would require to load all the tasks for each member

paglias avatar Jun 25 '16 13:06 paglias

Instead of loading all tasks for each member every time:

  • [ ] add a dateJoined field in the user.challenges schema
  • [ ] add something to the join-challenge logic that sets the dateJoined value
  • [ ] deploy the above changes and wait a little bit
  • [ ] have a one-time migration that sets all unset dateJoined values to the dateCreated value of the user's challenge's task(s)
  • [ ] THEN you can more easily sort challenge participants in the order in which they joined

khipkin avatar Jun 30 '16 13:06 khipkin

Unfortunately, it's not that easy. user.challenges is an Array of challenge ids. To do what you propose, it'd need to be an Array of Objects, which would be a breaking change for any integration that displays a user's challenges.

So, to do what you propose, we'd also have to transform the Array of Objects back to an Array of ids whenever someone requested the user object to maintain backwards compatibility.

crookedneighbor avatar Jun 30 '16 14:06 crookedneighbor

Hmmm... I see. What about adding a new field user.challengesDateJoined (or something more succinct) that maps challenge ids to date strings?

khipkin avatar Jun 30 '16 19:06 khipkin

I'd rather not. Probably the best course of action would be to have a new property. Something like user.challengesJoined that would be an object:

{
  'some-challenge-id': {
    dateJoined: DATE,
    otherProp: 'foo'
  },
  'some-other-challenge-id': {
    dateJoined: DATE,
    otherProp: 'foo'
  }
}

And then for backwards compatibility, user.challenges would be computed by looping over it and creating an array of ids.

crookedneighbor avatar Jul 01 '16 03:07 crookedneighbor

Is this still a desired fix?

librarianmage avatar Oct 20 '17 03:10 librarianmage

I believe so, unless there's a technical reason that we wouldn't want to do this!

lemoness avatar Oct 20 '17 21:10 lemoness

I've updated the labels on this issue.

lemoness avatar Oct 20 '17 21:10 lemoness

It should be noted that this information is available in the Challenge Data Tool now

cTheDragons avatar Oct 20 '17 22:10 cTheDragons

@cTheDragons How does the Challenge Data Tool track this info?

TheHollidayInn avatar Nov 17 '17 18:11 TheHollidayInn

The Challenge Data Tool uses the dates of when the task was created for each user and takes the earliest of when the the challenger joined the challenge.

cTheDragons avatar Nov 20 '17 13:11 cTheDragons

~~Closing this for now as Challenge participants can be sorted by join date.~~

Doh. Alys caught my mistake. 😄

Tressley avatar Apr 27 '20 13:04 Tressley

That join date sort is actually the date they joined Habitica. :) Knowing when they joined the challenge is what's needed to accurately judge the participants' progress.

Alys avatar Apr 28 '20 10:04 Alys

It should be noted that the Challenge Data Tool does show when the task was created for the person. However it not the same as the person join the challenge. (As task may be added throughout the challenge) And as noted earlier you do need to load all the tasks. (Which in the challenge data tool makes sense).

cTheDragons avatar May 02 '20 12:05 cTheDragons