Welcome to the Candy Crush Saga Community
Do you have a question or need help with your game? Ask the Community.
In that case it sounds like you found a bug. I don't win all levels on the first try. That is how I know chocolate box counts even if I fail the level. I haven't seen it not count for the troll when I win. It should tell you after every level how many were added for the troll.
In my game playing new levels I can usually just about manage to beat the troll, but collecting 5000 orange candies in 40 minutes is quite some feat. It would require us to pass at least 25 - 30 levels. If there is a an error I think it might be in your chocolate box order rather than the troll event. Are you quite sure you had not already started to make progress on the chocolate box order before the troll started?