11

The description of Snaphat says:

answer within 30 minutes of the question being asked, scoring 3 and getting accepted

I got this hat for the question that was asked on 2016-12-27 01:13:42Z. I answered this question on 2016-12-27 05:59:16Z, which is more than 30 minutes after it was asked. The hat was awarded the next day when the answer got third upvote.

It looks like a bug or incorrect description of the hat.

3

1 Answer 1

7

The description of the hat is correct. The problem was the hat was still being awarded incorrectly. There was a bug that we missed in the query that has now been fixed. Can you spot the bug in the line of code causing the problem?

And DateDiff(minute, a.CreationDate, q.CreationDate) <= 30

Basically, we had the answer creation date in the wrong position for the date comparison. Being in the wrong position, it always resulted in a negative number. The negative value meant that the hat was being awarded outside of the 30 minutes that was supposed to be required. The bug has since been squashed and the hat should now be awarded properly.

5
  • Thank you for fixing the problem. It is unlikely that I'll be able to earn this hat again to verify that bug was fixed. In any case, you haven't revoked it and you can't earn the same hat twice... Commented Jan 4, 2017 at 23:11
  • Apart from the order of parameters, if I saw such line in my code, I would think that it is strange to calculate minutes of the date. I would call the fields CreationDateTime to make it clear that they hold not just the date. Actually, I would call them CreationDateTimeUTC or CreationDateTimeLocal depending on what timestamp they hold. Commented Jan 4, 2017 at 23:14
  • @VladimirBaranov it's calculating the number of minutes between a start and end date, which does store a datetime. The issue was with the start and end date being reversed. And no we didn't revoke the hats that were incorrectly awarded.
    – Taryn StaffMod
    Commented Jan 4, 2017 at 23:17
  • I understand that your field CreationDate stores both date and time. My point was that I'd call it CreationDateTimeUTC. Commented Jan 4, 2017 at 23:18
  • @VladimirBaranov I get that, I'm just saying that our naming convention is to use CreationDate for things.
    – Taryn StaffMod
    Commented Jan 4, 2017 at 23:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .