# Devotee Badge and Timezones, relaxing requirements?

**URL:** <https://meta.discourse.org/t/devotee-badge-and-timezones-relaxing-requirements/144614>\
**Category:** Feature\
**Tags:** badges\
**Created:** [17 maart 2020 om 17:10 UTC](https://meta.discourse.org/t/devotee-badge-and-timezones-relaxing-requirements/144614 "2020-03-17T17:10:01Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![fearlessfrog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fearlessfrog/32/119653_2.png) [@fearlessfrog](https://meta.discourse.org/u/fearlessfrog)\
**Post date:** [17 maart 2020 om 18:55 UTC](https://meta.discourse.org/t/devotee-badge-and-timezones-relaxing-requirements/144614/3 "2020-03-17T18:55:05Z")

</div>

Thanks for looking and the response.

> [@Falco](#):
>
> It all depends on what your community wants in the end.

They want their badge to work regardless of their timezone. The long time users are the most passionate ones. 🙂

> [@Falco](#):
>
> Or check for users whose visit gaps are never more than 1 day.

We have a [Data Explorer](https://meta.discourse.org/t/32566?silent=true) query like this, which helped figure out the issue:

```
-- [params]
-- user_list :users

WITH StartingPoints AS (
  SELECT user_id, visited_at, ROW_NUMBER() OVER(ORDER BY user_id, visited_at) AS rownum
  FROM user_visits AS A
  WHERE NOT EXISTS (
     SELECT 1
     FROM user_visits AS B
     WHERE B.visited_at = A.visited_at - INTERVAL '1 day' AND
     B.user_id = A.user_id
  ) AND user_id IN (:users)
),
EndingPoints AS (
  SELECT user_id, visited_at, ROW_NUMBER() OVER(ORDER BY user_id, visited_at) AS rownum
  FROM user_visits AS A
  WHERE NOT EXISTS (
     SELECT 1
     FROM user_visits AS B
     WHERE B.visited_at = A.visited_at + INTERVAL '1 day' AND
     B.user_id = A.user_id
  ) AND user_id IN (:users)
)
SELECT u.username, S.visited_at AS start_range, E.visited_at AS end_range, (E.visited_at - S.visited_at + 1) AS Days
FROM StartingPoints AS S
JOIN EndingPoints AS E ON E.rownum = S.rownum
JOIN users u ON u.id=S.user_id AND
u.id IN (:users)
ORDER BY u.id ASC, S.visited_at DESC 

```

..which gives the continuous segments listed. Because of the UTC part (or rather how the underlying date is stored rather than datetime?), it seems fair that we should award the badge, even if a ‘1 day gap’ exists I think.

We’ll look at trying to create another Devotee badge based off of changing this query, perhaps with a ‘2 day’ INTERVAL?

---

_[View the full topic](https://meta.discourse.org/t/devotee-badge-and-timezones-relaxing-requirements/144614)._
