Group users into week long cohorts based on the user's signup date. For each cohort, calculate:
- The number of distinct users (orderers) who ordered in the first 7 days after signup. Older cohorts will have more buckets: i.e. 0-7 days, 7-14 days, 14-21 days, etc...
- The number of distinct users who ordered for the first time in each bucket
Please output an html table or CSV that looks something like this. It should include Cohorts, # users, & entries for each bucket.
(this is only an example. this is NOT real data)
| Cohort | Users | 0-7 days | 7-14 days | 14-21 days | ....
|-------------|-------------|-------------|------------|-------------|-------------
| 7/1-7/7 | 300 users | 25% orderers (75)<br>25% 1st time (75) | | |
| 6/24-6/30 | 200 users | 15% orderers (30)<br>15% 1st time (30) | 5% orderers (10)<br>1.5% 1st time (3) | |
| 6/17-6/23 | 100 users | 30% orderers (30)<br>30% 1st time (30) | 10% orderers (10)<br>3% 1st time (3) | 15% orderers (15)<br>5% 1st time (5) |
| ... | ... | ... | ... | ... | ...
- id
- created_at
- id
- user_id
- created_at
- order_num note: this field is 1-indexed
- Data ends in July '13
- You should default to 8 weeks back worth of cohorts, would be nice if this is customizable (via parameter or form or something)
- All dates are stored in UTC, but occured in PDT. Bonus points for handling that correctly.
- do order numbers count up from 1 for a given user? assuming yes.
- not clear what "weeks back worth of cohorts" - assuming this is columns of order weeks, rather than history back of cohort groups, mainly because it seems like you wouldn't want unlimited columns, though it sounds like you're asking to limit the number of rows?
- I'm leaving cells blank where there are no sales - seems more readable
rake import:users\[filename.csv]
rake import:orders\[filename.csv]
heroku create your-quiply-app-name
heroku buildpacks:set https://github.com/bundler/heroku-buildpack-bundler2
git push heroku master
This application was generated with the rails_apps_composer gem provided by the RailsApps Project.
Rails Composer is supported by developers who purchase our RailsApps tutorials.
Need help? Ask on Stack Overflow with the tag 'railsapps.'
Your application contains diagnostics in the README file. Please provide a copy of the README file when reporting any issues.
If the application doesn't work as expected, please report an issue and include the diagnostics.
This application requires:
- Ruby 2.3.0
- Rails 5.0.7.1
Learn more about Installing Rails.