6

I am writing a small widget that displays the time since I was awarded my last badge on Stack Overflow. I noticed that my most recent badge was missing from the timeline data (/users/{ids}/timeline).

After a bit more investigation, I found there are several badges that do not have a creation_date field, and these badges appear at the end of the returned data.

For example, when I run this query: /2.1/users/1367622/timeline?fromdate=1375920000&todate=1376006400&site=stackoverflow

I get:

{
  "items": [
    {
      "timeline_type": "badge",
      "user_id": 1367622,
      "badge_id": 83,
      "detail": "Fanatic"
    }
  ],
  "quota_remaining": 9951,
  "quota_max": 10000,
  "has_more": false
}

This is the correct date I was awarded the badge, however the creation_date field is missing. From looking at the doco, it was my understanding that the creation_date cannot be absent.

When I run this query to get all my timeline data: /2.1/users/1367622/timeline?page=3&pagesize=100&site=stackoverflow

the last items are:

{
  "creation_date": 1217540781,
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 2278,
  "detail": "Custodian"
},
{
  "creation_date": 1217540573,
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 2278,
  "detail": "Custodian"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 6,
  "detail": "Supporter"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 7,
  "detail": "Critic"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 8,
  "detail": "Citizen Patrol"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 9,
  "detail": "Autobiographer"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 13,
  "detail": "Yearling"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 31,
  "detail": "Commentator"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 32,
  "detail": "Civic Duty"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 71,
  "detail": "Enthusiast"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 83,
  "detail": "Fanatic"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 1306,
  "detail": "Analytical"
},
{
  "timeline_type": "badge",
  "user_id": 1367622,
  "badge_id": 2600,
  "detail": "Informed"
}

It appears that it is only user timeline objects with timeline_type "badge" that are missing the creation_date property, however there are items with an incorrect creation_date as well.

The top 2 items above do have a creation_date, but it is not correct. These two Custodian badges have creation_dates of 31/7/2008, but my timeline on Stack Overflow says they were actually awarded on 5/6/2013. I wasn't even a member of Stack Overflow in 2008, I joined in 2012!

Another example is this badge in my timeline:

{
  "creation_date": 1335872416,
  "post_type": "question",
  "timeline_type": "badge",
  "user_id": 1367622,
  "post_id": 10397150,
  "badge_id": 26,
  "title": "Infinite Scrolling - setContentOffset: stops deceleration of UIScrollView",
  "detail": "Popular Question"
},

This badge item contains all the necessary information, but the creation_date is the date I asked the original question, not the date I was awarded the badge.

I don't think this issue is just with badges either. For example, the same query includes this:

{
  "creation_date": 1254058162,
  "post_type": "question",
  "timeline_type": "revision",
  "user_id": 1367622,
  "post_id": 1483581,
  "title": "Get notified when UITableView has finished asking for data?",
  "detail": "Added code markers."
},

The creation_date returned is 27/9/2009, but the actual date for this revision was 17/6/2013.

Any ideas what's going on?

2
  • Interesting. For that edit, it is returning the time of the question's creation, many moons before your edit. (And way before you joined SO) Commented Aug 9, 2013 at 2:44
  • @BrockAdams You're right, I hadn't noticed that the edit was returning the date the original question was asked, just like the "Popular Question" badge item above it. Commented Aug 9, 2013 at 3:44

1 Answer 1

2

This was fixed in the latest deploy.

The bug was basically selecting the wrong date to display (in this case, an associated post), and the right date for filtering and what not. Since not all badges are associated with a post, not all displayed dates were set and when they were set they were off by some (basically random) amount.

You must log in to answer this question.

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