# Admin Panel Usage Export Missing Dates

**URL:** https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361
**Category:** Bug
**Created:** [November 8, 2015, 8:46pm UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361 "2015-11-08T20:46:03Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [November 8, 2015, 8:46pm UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/1 "2015-11-08T20:46:03Z")

</div>

Hope this one is fairly self explanatory. Today I attempted to do some data analysis on the Discourse usage. Was trying to compare New Users with Unique Visits with Posts. I went into the admin panel, opened the usage view for each stat, switched the start date, and clicked export.

When attempting to combine the 3 stats in my spreadsheet, I realized that there was different amounts of data for each stat, and found that on days where the stat was 0 (mostly had this issue with new users), no data was listed, and it just “skipped” the date. This required me to manually go through 3 years of dates and add the missing date (with 0 for stat) to allow the data comparison to work.

Expected result: Data should export with all dates within range and 0 where applicable. Much easier to filter out 0s from data than to find missing dates and add them.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [November 9, 2015, 2:26am UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/2 "2015-11-09T02:26:00Z")

</div>

To add some more clarity…this was the end goal/product:

 ![](https://global.discourse-cdn.com/meta/original/3X/2/a/2affb4fa02cd051f8ed805178ea720cab38dceaf.png)

In order to make that work I needed all the stats to line up with each other, and while Visits and Posts were always non-zero during the past 3ish years, New Users, especially towards the beginning of the timeline, had some dates where no one joined, thus causing ~50 less data points than the other stats.

P.S. For those curious about the large spike, that was the date the game was first released…

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [November 16, 2015, 4:24am UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/3 "2015-11-16T04:24:31Z")

</div>

Not sure if this is kosher, but I am going to “bump” this thread. I noticed that codinghorror and zogstrip liked the post (not pinging them as again I am not sure if that is allowed), so does that mean the bug is acknowledged? Should I expect a fix for this?

Again, sorry if this is not the right way to do things…

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [November 16, 2015, 9:49am UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/4 "2015-11-16T09:49:03Z")

</div>

I have it bookmarked and it’s on my TODO list. I have other priorities, but will see if I can move it up the list 😉

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [November 16, 2015, 10:07am UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/5 "2015-11-16T10:07:50Z")

</div>

Thanks @zogstrip! My “bumping” was not an effort to get it corrected quicker (I have already modified the data by hand), but simply to confirm if a discourse team member liking a bug indicated that it was acknowledged and queued for an (eventual) fix.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [November 16, 2015, 10:24am UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/6 "2015-11-16T10:24:50Z")

</div>

While I can’t speak for all the team members as we have different workflows, when I like a post describing a bug it means that I agree it is a bug. It doesn’t necessarily mean that I will fix it. I bookmark all the posts I want to fix, but since they aren’t public, I guess there’s no way for other users to see them. When I’m about to fix the bug though, I usually write a short post mostly because I want to check whether someone else is already working on it 😉

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [January 6, 2016, 9:16pm UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/7 "2016-01-06T21:16:41Z")

</div>

Looking to pull this data again, can you confirm if this has been fixed?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 6, 2016, 9:18pm UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/8 "2016-01-06T21:18:29Z")

</div>

It has **not**. I’m sorry I haven’t had the time to look at it yet ☹

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [January 6, 2016, 9:20pm UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/9 "2016-01-06T21:20:24Z")

</div>

No worries! 🙂 Thanks for the quick response!

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 6, 2016, 9:21pm UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/10 "2016-01-06T21:21:31Z")

</div>

I wouldn’t mind a PR 😉 I’m pretty sure the fix is only updating the SQL query to return rows with 0 when there are no values.

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [January 6, 2016, 9:22pm UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/11 "2016-01-06T21:22:27Z")

</div>

I’ll see what I can do. Never dug into the Discourse code, nor do I have much experience with Github…but I’ll give it a try!

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [January 8, 2016, 4:06am UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/12 "2016-01-08T04:06:36Z")

</div>

OK, so I signed the CLA, and started digging through the code, but I have no experience with Ruby and have no idea where to look. I found `https://github.com/discourse/discourse/blob/master/app/assets/javascripts/admin/templates/reports.hbs`, as well as `https://github.com/discourse/discourse/blob/master/app/assets/javascripts/admin/models/report.js.es6`, but they only seem to control what appears when viewing the report on the web. `https://github.com/discourse/discourse/blob/master/app/controllers/export_csv_controller.rb` and `https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/export-csv.js.es6`, seem to control the csv creation, but not what is stored in the csv.

Can you point me in the right direction?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [January 8, 2016, 8:49am UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/13 "2016-01-08T08:49:25Z")

</div>

Everything is in the [`report.rb`](https://github.com/discourse/discourse/blob/master/app/models/report.rb) model class and particularly the [`req_report`](https://github.com/discourse/discourse/blob/master/app/models/report.rb#L57) method.

---

<div class="post-metadata">

### Author: ![MakaryGo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/makarygo/32/187426_2.png) [@MakaryGo](https://meta.discourse.org/u/MakaryGo)
#### Post date: [May 25, 2017, 12:19pm UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/14 "2017-05-25T12:19:21Z")

</div>

Well, I took a look int that code, but I don’t understand much of it 😉 Any chance some Ruby Master could take a look at this issue maybe?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [January 18, 2018, 1:59am UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/15 "2018-01-18T01:59:46Z")

</div>

This issue has been [fixed](https://github.com/discourse/discourse/commit/b7ba490df7e596d5d9f291b47a179606168e3b06) when _viewing_ graph/table, but export is still missing dates with zero value. Added on my list.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [February 18, 2018, 7:11pm UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/16 "2018-02-18T19:11:11Z")

</div>

> [@techAPJ](#):
>
> The export is still missing dates with a zero value.

Fixed via:

> <https://github.com/discourse/discourse/commit/33df2d6a029cb9dd97124cd7866e1a090caf8b4f>

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [February 18, 2018, 7:11pm UTC](https://meta.discourse.org/t/admin-panel-usage-export-missing-dates/35361/17 "2018-02-18T19:11:19Z")

</div>


