General Info
My party just completed the Terror in the Taskwoods, Part 2: Finding the Flourishing Fairies collection quest where the party must collect 15 Brownies, 10 Dryads, and 25 Pixies.
The problem was that we quickly found the 10 Dryads, but it obviously took longer to get to 25 pixies. However, as we completed tasks, we kept on earning Dryads, even thought that objective was completed. So the progress counter on the Party page would say stuff like ~14/10~.
The expected behavior should be to only earn collection items in categories that are not yet satisfied. In the end, we had like double the Dryads necessary by the time we finished it out.
It seems like the logic is basically just assigning a "found item" event to a random category without checking to see if any more items of that type are required. It was a bit annoying to be earning "wasted" items on a collection quest, and it seems like a simple fix should be possible.
_edit by Admin:_
When cron runs for a participant of a collection quest, it gets the number of items that the user has found (that's just a single number with no distinction between the types of items). It randomly chooses the type of item for each item found and applies the results to the quest.
The same as above except that when randomly choosing items, it should ignore any item that the party has already found enough of.
There's a suggested fix at this comment: https://github.com/HabitRPG/habitica/issues/8248#issuecomment-561012497
This is currently working as intended, but it's a worthy tweak to consider. Given collection quests are generally not as engaging as boss quests, implementing this change as another way to make them a little less painful (the counts needed received a nerf recently already) might be worthwhile.
My personal feeling about this is that the current behaviour is more game-like and realistic because if you were walking through woods looking for items, you would typically find more of one kind by random chance. However I don't feel so strongly about it that I'd argue if the decision was to change it!
I think it would feel more satisfying if you only found items that were still pending -- right now, it feels like your effort can be wasted.
I've added this to the top post and marked this as help welcome:
When cron runs for a participant of a collection quest, it gets the number of items that the user has found (that's just a single number with no distinction between the types of items). It randomly chooses the type of item for each item found and applies the results to the quest.
The same as above except that when randomly choosing items, it should ignore any item that the party has already found enough of.
We received another report of this issue:
Il Mago Azzurro
UserID: c073342f-4a65-4a13-9ffd-9e7fa5410d6b
Is [Ensured quest drops are only from incomplete progress (users don't earn excess collection quest items) #9671](https://github.com/HabitRPG/habitica/pull/9671) already live? Because today I find myself with 20/15 of an object and 22/25 of an other thus not finishing the quest
I believe the cause is that we don't check to see if the user's pending items also complete the collection items.
Just noting that this bug is still happening. For example, for this collection quest:
https://github.com/HabitRPG/habitica/blob/c875861dab131278d2e8897495ede426e430d533/website/common/script/content/quests.js#L2137-L2150
party 436a63dd-28d1-4e71-b4e4-865b9217215e currently has these found items:
{
"quest": {
"progress": {
"collect": {
"pixie": 20,
"brownie": 18,
"dryad": 26
}
},
I.e., too many dryads and brownies have been found. The recent quest progress system messages show that it's not because a huge number of (for example) dryads were found in one hit - e.g.:
{
"text": "`[player 1] found 1 Dryads, 0 Pixies, 0 Brownies.`",
"timestamp": "2018-10-13T22:00:18.200Z",
"uuid": "system",
}
{
"text": "`[player 2] found 2 Pixies, 2 Brownies, 1 Dryads.`",
"timestamp": "2018-10-13T10:25:16.763Z",
"uuid": "system",
}
Picture version in case that helps anyone; noticed this yesterday.

I'm in this boat too - you can see yesterday that I collected my 22nd and 23rd mistifly (out of 15 needed). It's painful essentially rolling the dice each day hoping to finish this quest. I wouldn't even mind if it didn't count pending items, but as-is you can be stuck in an RNG loop indefinitely.

@etherfly (bf479514-05b1-450e-bba3-95497763bada) has reported this bug along with a guess at a possible cause:
"Hi. I've been experiencing a problem with collection quests. One of the item types needed for collection (dryads, for Taskwoods, Part 2 quest) has overflowed and keeps getting found along with another, not completely collected item type. At the moment I have
Pixies 22 / 25
Brownies 15 / 15
Dryads 34 / 10
I wouldn't see this as a bug, if it weren't for Brownies staying at 15/15. Makes me wonder if there is a strict == instead of a >= somewhere."
@Alys I went hunting through the code and found what I think is the some of the offending lines in randomDrop.js
Actually, doing some more digging to determine how the overall number of collected items is split into different categories, I came across this code:
And the key line is: https://github.com/HabitRPG/habitica/blob/b108b047cd853fd44a2d2048822f54b6e76f512f/website/server/models/group.js#L1105
That !== should be replaced with a <
That should resolve the collection quest issues.
@ksmith6 That looks very promising! Thanks for doing that investigation! Would you like to do a pull request for the fix?
@Alys - You can go ahead and make the pull request. When I tried to push the one-line fix branch to origin I didn't have sufficient privileges.
@ksmith6 Thanks for letting us know! I'll leave this open for a contributor to work on it. I'll edit the top post to draw attention to your suggested fix.
If you'd like to set up a local install for implementing, testing, and pushing changes like this, have a look at Setting up Habitica Locally on our wiki. Post here if you do decide to work on this and we'll mark it as in progress for you.
Most helpful comment
This is currently working as intended, but it's a worthy tweak to consider. Given collection quests are generally not as engaging as boss quests, implementing this change as another way to make them a little less painful (the counts needed received a nerf recently already) might be worthwhile.