Compare commits
54 Commits
develop
...
feature/le
| Author | SHA1 | Date |
|---|---|---|
|
|
158a68c040 | |
|
|
1ea912dd46 | |
|
|
0200748660 | |
|
|
b1e221cb0a | |
|
|
78d46c7e7c | |
|
|
0052b054b1 | |
|
|
34067cb61d | |
|
|
28d2e022ba | |
|
|
0a75c2408c | |
|
|
5a95f8b08d | |
|
|
fc38c7e597 | |
|
|
5479d8e6bf | |
|
|
2e8feea25b | |
|
|
4b4b50cb86 | |
|
|
cf3d7cddd3 | |
|
|
5b578389e8 | |
|
|
af2e681916 | |
|
|
b69669d5df | |
|
|
7a4143ab47 | |
|
|
7921677d9d | |
|
|
e2b7eec291 | |
|
|
f587eb7260 | |
|
|
42cb7369fb | |
|
|
8b143235cc | |
|
|
1f2c327eea | |
|
|
5933b42480 | |
|
|
ebcf45fdda | |
|
|
0e1c070c89 | |
|
|
298c6e5bc5 | |
|
|
c0cc072b1c | |
|
|
2e405c3e5d | |
|
|
d9a314a153 | |
|
|
14a79c35b5 | |
|
|
3873b05ad1 | |
|
|
8b3aa3e2cd | |
|
|
bcbd0191ef | |
|
|
3a99a3a47d | |
|
|
1e5f5caacc | |
|
|
1dfb7fbd9a | |
|
|
f6d5b520fb | |
|
|
f42b390c50 | |
|
|
b0477ff511 | |
|
|
61fbc24a15 | |
|
|
b65804bea6 | |
|
|
0707c9054b | |
|
|
fa9aabed55 | |
|
|
a20978e370 | |
|
|
ef43622ae2 | |
|
|
c685316f21 | |
|
|
2b0942c5f4 | |
|
|
669e91e9a5 | |
|
|
61fbba418f | |
|
|
93880bddf0 | |
|
|
a327412a88 |
|
|
@ -1,25 +0,0 @@
|
|||
name: Build Admin
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: dagger
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
|
||||
- name: Install Dagger
|
||||
run: |
|
||||
curl -L https://dl.dagger.io/dagger/install.sh | sh
|
||||
sudo mv bin/dagger /usr/local/bin/
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
run: echo "${{ gitea.token }}" | docker login git.staging.jamkazam.com -u ${{ gitea.actor }} --password-stdin
|
||||
|
||||
- name: Build and Publish with Dagger
|
||||
working-directory: ./admin
|
||||
run: |
|
||||
dagger call build-local --source=. --repo-root=../ publish --address=git.staging.jamkazam.com/seth/jam-cloud-admin:latest
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
name: Environment Orchestrator
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
orchestrate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Component Deployment Gatekeeper
|
||||
run: |
|
||||
# JAM_CLUSTER_ENV should be set to 'staging' or 'production' in the Gitea Runner
|
||||
ENV="${JAM_CLUSTER_ENV:-staging}"
|
||||
echo "🌐 Cluster Environment: $ENV"
|
||||
|
||||
# 1. Extract modes for this environment
|
||||
ADMIN_MODE=$(jq -r ".environments.$ENV.admin" .jk-deploy.json)
|
||||
WEB_MODE=$(jq -r ".environments.$ENV.web" .jk-deploy.json)
|
||||
WS_MODE=$(jq -r ".environments.$ENV.[\"websocket-gateway\"]" .jk-deploy.json)
|
||||
|
||||
# 2. Conditional Execution
|
||||
if [ "$ADMIN_MODE" == "short-circuit" ]; then
|
||||
echo "⚡ ADMIN: Short-circuit detected. Deploying immediately..."
|
||||
cd admin && dagger call ship --source=.
|
||||
else
|
||||
echo "⏸️ ADMIN: Mode is $ADMIN_MODE. Skipping short-circuit deploy."
|
||||
fi
|
||||
|
||||
if [ "$WEB_MODE" == "short-circuit" ]; then
|
||||
echo "⚡ WEB: Short-circuit detected. Deploying immediately..."
|
||||
cd web && dagger call ship --source=.
|
||||
else
|
||||
echo "⏸️ WEB: Mode is $WEB_MODE. Skipping short-circuit deploy."
|
||||
fi
|
||||
|
||||
if [ "$WS_MODE" == "short-circuit" ]; then
|
||||
echo "⚡ WS-GATEWAY: Short-circuit detected. Deploying immediately..."
|
||||
cd websocket-gateway && just ship
|
||||
else
|
||||
echo "⏸️ WS-GATEWAY: Mode is $WS_MODE. Skipping short-circuit deploy."
|
||||
fi
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
name: Test Runner
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "Runner is working!"
|
||||
|
|
@ -8,7 +8,3 @@ HTML
|
|||
coverage
|
||||
dump.rdb
|
||||
working.png
|
||||
ruby/.rails5-gems
|
||||
web/.rails5-gems
|
||||
websocket-gateway/.rails5-gems
|
||||
.pg_data/
|
||||
|
|
@ -1 +0,0 @@
|
|||
2.4.1
|
||||
|
|
@ -20,7 +20,4 @@ artifacts
|
|||
*.iml
|
||||
.idea
|
||||
BUILD_NUMBER
|
||||
# Gemfile.lock
|
||||
Gemfile.alt.lock
|
||||
.byebug_history
|
||||
.ruby-version
|
||||
Gemfile.lock
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Settings><!--This file was automatically generated by Ruby plugin.
|
||||
You are allowed to:
|
||||
1. Remove rake task
|
||||
2. Add existing rake tasks
|
||||
To add existing rake tasks automatically delete this file and reload the project.
|
||||
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
||||
|
|
@ -1 +0,0 @@
|
|||
2.4.1
|
||||
140
admin/Gemfile
140
admin/Gemfile
|
|
@ -1,88 +1,57 @@
|
|||
source 'http://rubygems.org'
|
||||
|
||||
source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/'
|
||||
ruby_version = ENV["JAM_RUBY_VERSION"]
|
||||
ruby_version = "2.3.1" if ruby_version.nil?
|
||||
|
||||
ruby ruby_version
|
||||
|
||||
devenv = ENV["BUILD_NUMBER"].nil?
|
||||
|
||||
if devenv
|
||||
#gem 'jam_db', :path=> "../db/target/ruby_package"
|
||||
gem 'jam_db', :path=> "../db/target/ruby_package"
|
||||
gem 'jampb', :path => "../pb/target/ruby/jampb"
|
||||
gem 'jam_ruby', :path => "../ruby"
|
||||
else
|
||||
source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/' do
|
||||
#gem 'jam_db', "0.1.#{ENV["BUILD_NUMBER"]}"
|
||||
gem 'jampb', "0.1.#{ENV["BUILD_NUMBER"]}"
|
||||
gem 'jam_ruby', "0.1.#{ENV["BUILD_NUMBER"]}"
|
||||
ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] ||= "true"
|
||||
end
|
||||
gem 'jam_db', "0.1.#{ENV["BUILD_NUMBER"]}"
|
||||
gem 'jampb', "0.1.#{ENV["BUILD_NUMBER"]}"
|
||||
gem 'jam_ruby', "0.1.#{ENV["BUILD_NUMBER"]}"
|
||||
ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] ||= "true"
|
||||
end
|
||||
|
||||
gem 'activeadmin_addons'
|
||||
gem 'json', '1.8.6'
|
||||
gem 'rails', '= 4.2.8'
|
||||
gem 'protected_attributes'
|
||||
gem 'rails-observers'
|
||||
|
||||
|
||||
# PINNED TO SUPPORT BOTH 2.3.1 and 2.4.1 Ruby simultaneously
|
||||
# This should be the same in ruby/admin/web/websocket-gateway
|
||||
#######
|
||||
gem 'nokogiri', '1.10.10' # added to pin before 1.11.0, which requires at leaost ruby 2.5. unpin we go above
|
||||
gem 'sprockets', '3.6.3' # added to pin before 4.0.0, which requiurse at least ruby 2.5
|
||||
gem 'fog-brightbox', '0.11.0' # pinned until we are on ruby 2.5; then remove
|
||||
gem 'faraday', '0.9.2' # pinned untnil we are on ruby 2.5; then remove
|
||||
gem 'ruby-prof', '0.15.9' # pinned until we are on ruby 2.5; then remove
|
||||
gem 'rubyzip', '1.2.1' # pinned until we are on ruby 2.5; then remove
|
||||
gem 'recurly', '2.18.16' # should upgrade to 3.x when we have time to validaate
|
||||
gem 'icalendar', '2.4.0' # pinned until we are on ruby 2.5; then remove
|
||||
gem 'email_validator', '1.6.0' # pinned until we are on ruby 2.5, then remove
|
||||
gem 'redis', '3.3.3' # pinned until we are on 2.5; then remove
|
||||
gem 'redis-namespace', '1.5.3' # pinned until we are on 2.5; then remove
|
||||
gem 'oj', '3.1.3' # pinned until we are on 2.5; then remove
|
||||
gem 'bcrypt', '3.1.15'
|
||||
gem 'sass-rails', '5.0.7' # compiler mismatch issue between build and www
|
||||
gem 'sass', '3.5.5 '# compiler mismatch issue between build and www
|
||||
#######
|
||||
|
||||
gem 'rails', '~> 3.2.22'
|
||||
gem 'bootstrap-sass', '2.0.4'
|
||||
gem 'bcrypt-ruby', '3.0.1'
|
||||
|
||||
gem 'coffee-rails' #, '~> 3.2.1'
|
||||
# Gems used only for assets and not required
|
||||
# in production environments by default.
|
||||
group :assets do
|
||||
gem 'sass-rails', '~> 3.2.3'
|
||||
gem 'coffee-rails', '~> 3.2.1'
|
||||
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
# gem 'therubyracer', :platforms => :ruby
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
# gem 'therubyracer', :platforms => :ruby
|
||||
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
|
||||
# this version is pinned due to this: https://github.com/gregbell/active_admin/issues/1939
|
||||
gem 'coffee-script-source', '~> 1.4.0' # ADD THIS LINE, 1.5.0 doesn't compile ActiveAdmin JavaScript files
|
||||
end
|
||||
gem 'kickbox'
|
||||
gem 'uglifier' #, '>= 1.0.3'
|
||||
gem 'net-ssh'
|
||||
gem 'sprockets-rails', '2.3.2'
|
||||
|
||||
# this version is pinned due to this: https://github.com/gregbell/active_admin/issues/1939
|
||||
gem 'coffee-script-source' #, '~> 1.4.0' # ADD THIS LINE, 1.5.0 doesn't compile ActiveAdmin JavaScript files
|
||||
gem 'devise' #, '3.3.0'
|
||||
gem 'will_paginate' #, '3.0.3'
|
||||
gem 'devise', '3.3.0'
|
||||
gem 'will_paginate', '3.0.3'
|
||||
gem 'bootstrap-will_paginate', '0.0.6'
|
||||
gem 'carrierwave', '0.11.2' #, '0.9.0'
|
||||
gem 'carrierwave', '0.9.0'
|
||||
gem 'carrierwave_direct'
|
||||
gem 'uuidtools', '2.1.2'
|
||||
gem 'jquery-ui-rails'# , '5.0.5' #, '4.2.1'
|
||||
gem 'jquery-rails'# , '4.1.1' # both this and jquery-ui-rails are pinned; if you unpin, jquery/autocomplete is missing during precomplie
|
||||
gem 'rails-jquery-autocomplete' # This is the maintained version of rails3-jquery-autocomplete
|
||||
gem 'activeadmin' #, '1.0.0.pre4'# github: 'activeadmin', branch: 'master'
|
||||
gem 'activeadmin-searchable_select'
|
||||
gem 'jquery-rails' # , '2.3.0' # pinned because jquery-ui-rails was split from jquery-rails, but activeadmin doesn't support this gem yet
|
||||
gem 'jquery-ui-rails', '4.2.1'
|
||||
gem 'rails3-jquery-autocomplete'
|
||||
gem 'activeadmin' #, github: 'activeadmin', branch: '0-6-stable'
|
||||
gem 'mime-types', '1.25'
|
||||
#gem 'meta_search'
|
||||
gem 'meta_search'
|
||||
gem 'fog'
|
||||
gem 'xmlrpc'
|
||||
gem 'unf', '0.1.3' #optional fog dependency
|
||||
gem 'country-select'
|
||||
gem 'aasm' #, '3.0.16'
|
||||
gem 'aasm', '3.0.16'
|
||||
gem 'postgres-copy', '0.6.0'
|
||||
gem 'aws-sdk', '~> 1'
|
||||
gem 'bugsnag', '5.3.2'
|
||||
gem 'bugsnag'
|
||||
gem 'gon'
|
||||
gem 'cocoon'
|
||||
gem 'haml-rails'
|
||||
|
|
@ -90,41 +59,31 @@ gem 'resque'
|
|||
gem 'resque-retry'
|
||||
gem 'resque-failed-job-mailer'
|
||||
gem 'resque-lonely_job', '~> 1.0.0'
|
||||
gem 'eventmachine', '1.2.3'
|
||||
gem 'eventmachine', '1.0.4'
|
||||
gem 'amqp', '0.9.8'
|
||||
#gem 'logging-rails', :require => 'logging/rails'
|
||||
#gem 'pg_migrate', '0.1.14'
|
||||
if ENV["MODERN_OS"] == "1"
|
||||
gem 'pg', '0.21.0'
|
||||
else
|
||||
# on mac, bundle config build.pg --with-cflags="-Wno-error=implicit-function-declaration"
|
||||
gem 'pg', '0.17.1', :platform => [:mri, :mswin, :mingw]
|
||||
end
|
||||
gem 'logging-rails', :require => 'logging/rails'
|
||||
gem 'pg_migrate'
|
||||
gem 'ruby-protocol-buffers', '1.2.2'
|
||||
gem 'sendgrid', '1.2.0'
|
||||
gem 'geokit-rails'
|
||||
gem 'postgres_ext' #, '1.0.0'
|
||||
gem 'postgres_ext', '1.0.0'
|
||||
gem 'resque_mailer'
|
||||
gem 'rest-client'
|
||||
gem 'iso-639'
|
||||
gem 'rubyzip'
|
||||
gem 'sanitize'
|
||||
gem 'slim'
|
||||
#gem 'influxdb', '0.1.8'
|
||||
#gem 'influxdb-rails', '0.1.10'
|
||||
gem 'influxdb', '0.3.14'
|
||||
gem 'influxdb-rails', '0.1.12'
|
||||
gem 'influxdb', '0.1.8'
|
||||
gem 'influxdb-rails', '0.1.10'
|
||||
gem 'recurly'
|
||||
gem 'sendgrid_toolkit', '>= 1.1.1'
|
||||
gem 'stripe'
|
||||
gem 'zip-codes'
|
||||
gem 'best_in_place' #, github: 'bernat/best_in_place'
|
||||
gem 'auto_strip_attributes', '2.6.0'
|
||||
gem 'elasticsearch'
|
||||
gem 'email_validator'
|
||||
|
||||
gem 'logging', '1.7.2'
|
||||
|
||||
#group :libv8 do
|
||||
# gem 'libv8', "~> 4.5.95"
|
||||
#end
|
||||
group :libv8 do
|
||||
gem 'libv8', "~> 4.5.95"
|
||||
end
|
||||
|
||||
|
||||
# To use Jbuilder templates for JSON
|
||||
|
|
@ -145,14 +104,15 @@ end
|
|||
#gem 'debugger' # not working with 2.1.2p95
|
||||
|
||||
group :development, :test do
|
||||
gem 'capybara', '2.13.0'
|
||||
gem 'rspec-rails' #, '2.14.2'
|
||||
gem 'capybara'
|
||||
gem 'rspec-rails', '2.14.2'
|
||||
gem 'guard-rspec'
|
||||
gem 'jasmine', '1.3.1'
|
||||
gem 'execjs', '1.4.0'
|
||||
#gem 'therubyracer' #, '0.11.0beta8'
|
||||
gem 'factory_girl_rails' # , '4.1.0'
|
||||
gem 'database_cleaner' #, '0.7.0'
|
||||
gem 'launchy', '2.4.3' # can unpin when go to ruby 2.4+
|
||||
gem 'factory_girl_rails', '4.1.0'
|
||||
gem 'database_cleaner', '0.7.0'
|
||||
gem 'launchy'
|
||||
gem 'faker', '1.3.0'
|
||||
gem 'puma'
|
||||
gem 'test-unit'
|
||||
|
|
@ -161,9 +121,9 @@ end
|
|||
group :test do
|
||||
gem 'simplecov', '~> 0.7.1'
|
||||
gem 'simplecov-rcov'
|
||||
# gem 'capybara-webkit'
|
||||
# gem 'capybara-screenshot', '0.3.22' # 1.0.0 broke compat with rspec. maybe we need newer rspec
|
||||
# gem 'poltergeist'
|
||||
gem 'capybara-webkit'
|
||||
gem 'capybara-screenshot', '0.3.22' # 1.0.0 broke compat with rspec. maybe we need newer rspec
|
||||
gem 'poltergeist'
|
||||
end
|
||||
|
||||
gem 'pry'
|
||||
|
|
|
|||
|
|
@ -1,172 +0,0 @@
|
|||
source 'http://rubygems.org'
|
||||
|
||||
source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/'
|
||||
ruby_version = ENV["JAM_RUBY_VERSION"]
|
||||
ruby_version = "2.3.1" if ruby_version.nil?
|
||||
|
||||
ruby ruby_version
|
||||
|
||||
devenv = ENV["BUILD_NUMBER"].nil?
|
||||
|
||||
if devenv
|
||||
#gem 'jam_db', :path=> "../db/target/ruby_package"
|
||||
gem 'jampb', :path => "../pb/target/ruby/jampb"
|
||||
gem 'jam_ruby', :path => "../ruby"
|
||||
else
|
||||
source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/' do
|
||||
#gem 'jam_db', "0.1.#{ENV["BUILD_NUMBER"]}"
|
||||
gem 'jampb', "0.1.#{ENV["BUILD_NUMBER"]}"
|
||||
gem 'jam_ruby', "0.1.#{ENV["BUILD_NUMBER"]}"
|
||||
ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] ||= "true"
|
||||
end
|
||||
end
|
||||
|
||||
gem 'activeadmin_addons'
|
||||
gem 'json', '1.8.6'
|
||||
gem 'rails', '= 4.2.8'
|
||||
gem 'protected_attributes'
|
||||
gem 'rails-observers'
|
||||
|
||||
|
||||
# PINNED TO SUPPORT BOTH 2.3.1 and 2.4.1 Ruby simultaneously
|
||||
# This should be the same in ruby/admin/web/websocket-gateway
|
||||
#######
|
||||
gem 'nokogiri', '1.10.10' # added to pin before 1.11.0, which requires at leaost ruby 2.5. unpin we go above
|
||||
gem 'sprockets', '3.6.3' # added to pin before 4.0.0, which requiurse at least ruby 2.5
|
||||
gem 'fog-brightbox', '0.11.0' # pinned until we are on ruby 2.5; then remove
|
||||
gem 'faraday', '0.9.2' # pinned untnil we are on ruby 2.5; then remove
|
||||
gem 'ruby-prof', '0.15.9' # pinned until we are on ruby 2.5; then remove
|
||||
gem 'rubyzip', '1.2.1' # pinned until we are on ruby 2.5; then remove
|
||||
gem 'recurly', '2.18.16' # should upgrade to 3.x when we have time to validaate
|
||||
gem 'icalendar', '2.4.0' # pinned until we are on ruby 2.5; then remove
|
||||
gem 'email_validator', '1.6.0' # pinned until we are on ruby 2.5, then remove
|
||||
gem 'redis', '3.3.3' # pinned until we are on 2.5; then remove
|
||||
gem 'redis-namespace', '1.5.3' # pinned until we are on 2.5; then remove
|
||||
gem 'oj', '3.1.3' # pinned until we are on 2.5; then remove
|
||||
gem 'bcrypt', '3.1.15'
|
||||
gem 'sass-rails', '5.0.7' # compiler mismatch issue between build and www
|
||||
gem 'sass', '3.5.5 '# compiler mismatch issue between build and www
|
||||
#######
|
||||
|
||||
gem 'bootstrap-sass', '2.0.4'
|
||||
|
||||
gem 'coffee-rails' #, '~> 3.2.1'
|
||||
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
# gem 'therubyracer', :platforms => :ruby
|
||||
|
||||
gem 'kickbox'
|
||||
gem 'uglifier' #, '>= 1.0.3'
|
||||
gem 'net-ssh'
|
||||
gem 'sprockets-rails', '2.3.2'
|
||||
|
||||
# this version is pinned due to this: https://github.com/gregbell/active_admin/issues/1939
|
||||
gem 'coffee-script-source' #, '~> 1.4.0' # ADD THIS LINE, 1.5.0 doesn't compile ActiveAdmin JavaScript files
|
||||
gem 'devise' #, '3.3.0'
|
||||
gem 'will_paginate' #, '3.0.3'
|
||||
gem 'bootstrap-will_paginate', '0.0.6'
|
||||
gem 'carrierwave', '0.11.2' #, '0.9.0'
|
||||
gem 'carrierwave_direct'
|
||||
gem 'uuidtools', '2.1.2'
|
||||
gem 'jquery-ui-rails'# , '5.0.5' #, '4.2.1'
|
||||
gem 'jquery-rails'# , '4.1.1' # both this and jquery-ui-rails are pinned; if you unpin, jquery/autocomplete is missing during precomplie
|
||||
gem 'rails-jquery-autocomplete' # This is the maintained version of rails3-jquery-autocomplete
|
||||
gem 'activeadmin' #, '1.0.0.pre4'# github: 'activeadmin', branch: 'master'
|
||||
gem 'activeadmin-searchable_select'
|
||||
gem 'mime-types', '1.25'
|
||||
#gem 'meta_search'
|
||||
gem 'fog'
|
||||
gem 'xmlrpc'
|
||||
gem 'unf', '0.1.3' #optional fog dependency
|
||||
gem 'country-select'
|
||||
gem 'aasm' #, '3.0.16'
|
||||
gem 'postgres-copy', '0.6.0'
|
||||
gem 'aws-sdk', '~> 1'
|
||||
gem 'bugsnag', '5.3.2'
|
||||
gem 'gon'
|
||||
gem 'cocoon'
|
||||
gem 'haml-rails'
|
||||
gem 'resque'
|
||||
gem 'resque-retry'
|
||||
gem 'resque-failed-job-mailer'
|
||||
gem 'resque-lonely_job', '~> 1.0.0'
|
||||
gem 'eventmachine', '1.2.3'
|
||||
gem 'amqp', '0.9.8'
|
||||
#gem 'logging-rails', :require => 'logging/rails'
|
||||
#gem 'pg_migrate', '0.1.14'
|
||||
if ENV["MODERN_OS"] == "1"
|
||||
gem 'pg', '0.21.0'
|
||||
else
|
||||
# on mac, bundle config build.pg --with-cflags="-Wno-error=implicit-function-declaration"
|
||||
gem 'pg', '0.17.1', :platform => [:mri, :mswin, :mingw]
|
||||
end
|
||||
gem 'ruby-protocol-buffers', '1.2.2'
|
||||
gem 'sendgrid', '1.2.0'
|
||||
gem 'geokit-rails'
|
||||
gem 'postgres_ext' #, '1.0.0'
|
||||
gem 'resque_mailer'
|
||||
gem 'rest-client'
|
||||
gem 'iso-639'
|
||||
gem 'sanitize'
|
||||
gem 'slim'
|
||||
#gem 'influxdb', '0.1.8'
|
||||
#gem 'influxdb-rails', '0.1.10'
|
||||
gem 'influxdb', '0.3.14'
|
||||
gem 'influxdb-rails', '0.1.12'
|
||||
gem 'sendgrid_toolkit', '>= 1.1.1'
|
||||
gem 'stripe'
|
||||
gem 'zip-codes'
|
||||
gem 'best_in_place' #, github: 'bernat/best_in_place'
|
||||
gem 'auto_strip_attributes', '2.6.0'
|
||||
gem 'elasticsearch'
|
||||
|
||||
gem 'logging', '1.7.2'
|
||||
|
||||
#group :libv8 do
|
||||
# gem 'libv8', "~> 4.5.95"
|
||||
#end
|
||||
|
||||
|
||||
# To use Jbuilder templates for JSON
|
||||
# gem 'jbuilder'
|
||||
|
||||
group :production do
|
||||
gem 'unicorn'
|
||||
end
|
||||
|
||||
group :package do
|
||||
gem 'fpm'
|
||||
end
|
||||
|
||||
# Deploy with Capistrano
|
||||
# gem 'capistrano'
|
||||
|
||||
# To use debugger
|
||||
#gem 'debugger' # not working with 2.1.2p95
|
||||
|
||||
group :development, :test do
|
||||
gem 'capybara', '2.13.0'
|
||||
gem 'rspec-rails' #, '2.14.2'
|
||||
gem 'jasmine', '1.3.1'
|
||||
gem 'execjs', '1.4.0'
|
||||
#gem 'therubyracer' #, '0.11.0beta8'
|
||||
gem 'factory_girl_rails' # , '4.1.0'
|
||||
gem 'database_cleaner' #, '0.7.0'
|
||||
gem 'launchy', '2.4.3' # can unpin when go to ruby 2.4+
|
||||
gem 'faker', '1.3.0'
|
||||
gem 'puma'
|
||||
gem 'test-unit'
|
||||
end
|
||||
|
||||
group :test do
|
||||
gem 'simplecov', '~> 0.7.1'
|
||||
gem 'simplecov-rcov'
|
||||
# gem 'capybara-webkit'
|
||||
# gem 'capybara-screenshot', '0.3.22' # 1.0.0 broke compat with rspec. maybe we need newer rspec
|
||||
# gem 'poltergeist'
|
||||
end
|
||||
|
||||
gem 'pry'
|
||||
gem 'pry-remote'
|
||||
gem 'pry-stack_explorer'
|
||||
#gem 'pry-debugger'
|
||||
|
|
@ -1,799 +0,0 @@
|
|||
PATH
|
||||
remote: ../pb/target/ruby/jampb
|
||||
specs:
|
||||
jampb (0.1.1)
|
||||
|
||||
PATH
|
||||
remote: ../ruby
|
||||
specs:
|
||||
jam_ruby (0.1.1)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
remote: https://jamjam:blueberryjam@int.jamkazam.com/gems/
|
||||
specs:
|
||||
CFPropertyList (2.3.6)
|
||||
aasm (5.1.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
actionmailer (4.2.8)
|
||||
actionpack (= 4.2.8)
|
||||
actionview (= 4.2.8)
|
||||
activejob (= 4.2.8)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
actionpack (4.2.8)
|
||||
actionview (= 4.2.8)
|
||||
activesupport (= 4.2.8)
|
||||
rack (~> 1.6)
|
||||
rack-test (~> 0.6.2)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (4.2.8)
|
||||
activesupport (= 4.2.8)
|
||||
builder (~> 3.1)
|
||||
erubis (~> 2.7.0)
|
||||
rails-dom-testing (~> 1.0, >= 1.0.5)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
active_material (1.4.2)
|
||||
activeadmin (1.4.3)
|
||||
arbre (>= 1.1.1)
|
||||
coffee-rails
|
||||
formtastic (~> 3.1)
|
||||
formtastic_i18n
|
||||
inherited_resources (>= 1.9.0)
|
||||
jquery-rails (>= 4.2.0)
|
||||
kaminari (>= 0.15)
|
||||
railties (>= 4.2, < 5.3)
|
||||
ransack (>= 1.8.7)
|
||||
sass (~> 3.1)
|
||||
sprockets (< 4.1)
|
||||
activeadmin-searchable_select (1.4.0)
|
||||
activeadmin (>= 1.x, < 3)
|
||||
jquery-rails (>= 3.0, < 5)
|
||||
select2-rails (~> 4.0)
|
||||
activeadmin_addons (1.7.1)
|
||||
active_material
|
||||
railties
|
||||
require_all (~> 1.5)
|
||||
sass
|
||||
select2-rails (~> 4.0)
|
||||
xdan-datetimepicker-rails (~> 2.5.1)
|
||||
activejob (4.2.8)
|
||||
activesupport (= 4.2.8)
|
||||
globalid (>= 0.3.0)
|
||||
activemodel (4.2.8)
|
||||
activesupport (= 4.2.8)
|
||||
builder (~> 3.1)
|
||||
activerecord (4.2.8)
|
||||
activemodel (= 4.2.8)
|
||||
activesupport (= 4.2.8)
|
||||
arel (~> 6.0)
|
||||
activesupport (4.2.8)
|
||||
i18n (~> 0.7)
|
||||
minitest (~> 5.1)
|
||||
thread_safe (~> 0.3, >= 0.3.4)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
aliyun-sdk (0.8.0)
|
||||
nokogiri (~> 1.6)
|
||||
rest-client (~> 2.0)
|
||||
amq-client (0.9.12)
|
||||
amq-protocol (>= 1.2.0)
|
||||
eventmachine
|
||||
amq-protocol (2.3.2)
|
||||
amqp (0.9.8)
|
||||
amq-client (~> 0.9.5)
|
||||
amq-protocol (>= 0.9.4)
|
||||
eventmachine
|
||||
arbre (1.2.1)
|
||||
activesupport (>= 3.0.0)
|
||||
arel (6.0.4)
|
||||
arr-pm (0.0.10)
|
||||
cabin (> 0)
|
||||
auto_strip_attributes (2.6.0)
|
||||
activerecord (>= 4.0)
|
||||
aws-sdk (1.67.0)
|
||||
aws-sdk-v1 (= 1.67.0)
|
||||
aws-sdk-v1 (1.67.0)
|
||||
json (~> 1.4)
|
||||
nokogiri (~> 1)
|
||||
backports (3.20.2)
|
||||
bcrypt (3.1.15)
|
||||
best_in_place (3.1.1)
|
||||
actionpack (>= 3.2)
|
||||
railties (>= 3.2)
|
||||
binding_of_caller (0.8.0)
|
||||
debug_inspector (>= 0.0.1)
|
||||
bootstrap-sass (2.0.4.0)
|
||||
bootstrap-will_paginate (0.0.6)
|
||||
will_paginate
|
||||
bugsnag (5.3.2)
|
||||
builder (3.2.4)
|
||||
cabin (0.9.0)
|
||||
capybara (2.13.0)
|
||||
addressable
|
||||
mime-types (>= 1.16)
|
||||
nokogiri (>= 1.3.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-test (>= 0.5.4)
|
||||
xpath (~> 2.0)
|
||||
carrierwave (0.11.2)
|
||||
activemodel (>= 3.2.0)
|
||||
activesupport (>= 3.2.0)
|
||||
json (>= 1.7)
|
||||
mime-types (>= 1.16)
|
||||
mimemagic (>= 0.3.0)
|
||||
carrierwave_direct (1.0.0)
|
||||
carrierwave (~> 0.11)
|
||||
fog-aws
|
||||
cause (0.1)
|
||||
childprocess (0.9.0)
|
||||
ffi (~> 1.0, >= 1.0.11)
|
||||
clamp (1.0.1)
|
||||
cocoon (1.2.15)
|
||||
coderay (1.1.3)
|
||||
coffee-rails (4.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (>= 4.0.0)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.12.2)
|
||||
concurrent-ruby (1.1.8)
|
||||
country-select (1.2.1)
|
||||
crass (1.0.6)
|
||||
database_cleaner (1.99.0)
|
||||
debug_inspector (1.0.0)
|
||||
devise (4.7.3)
|
||||
bcrypt (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (>= 4.1.0)
|
||||
responders
|
||||
warden (~> 1.2.3)
|
||||
diff-lcs (1.4.4)
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
dotenv (2.7.6)
|
||||
elasticsearch (7.4.0)
|
||||
elasticsearch-api (= 7.4.0)
|
||||
elasticsearch-transport (= 7.4.0)
|
||||
elasticsearch-api (7.4.0)
|
||||
multi_json
|
||||
elasticsearch-transport (7.4.0)
|
||||
faraday
|
||||
multi_json
|
||||
email_validator (1.6.0)
|
||||
activemodel
|
||||
erubis (2.7.0)
|
||||
et-orbi (1.2.4)
|
||||
tzinfo
|
||||
eventmachine (1.2.3)
|
||||
excon (0.79.0)
|
||||
execjs (1.4.0)
|
||||
multi_json (~> 1.0)
|
||||
factory_girl (4.9.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (4.9.0)
|
||||
factory_girl (~> 4.9.0)
|
||||
railties (>= 3.0.0)
|
||||
faker (1.3.0)
|
||||
i18n (~> 0.5)
|
||||
faraday (0.9.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.12.2)
|
||||
fission (0.5.0)
|
||||
CFPropertyList (~> 2.2)
|
||||
fog (1.41.0)
|
||||
fog-aliyun (>= 0.1.0)
|
||||
fog-atmos
|
||||
fog-aws (>= 0.6.0)
|
||||
fog-brightbox (~> 0.4)
|
||||
fog-cloudatcost (~> 0.1.0)
|
||||
fog-core (~> 1.45)
|
||||
fog-digitalocean (>= 0.3.0)
|
||||
fog-dnsimple (~> 1.0)
|
||||
fog-dynect (~> 0.0.2)
|
||||
fog-ecloud (~> 0.1)
|
||||
fog-google (<= 0.1.0)
|
||||
fog-internet-archive
|
||||
fog-joyent
|
||||
fog-json
|
||||
fog-local
|
||||
fog-openstack
|
||||
fog-powerdns (>= 0.1.1)
|
||||
fog-profitbricks
|
||||
fog-rackspace
|
||||
fog-radosgw (>= 0.0.2)
|
||||
fog-riakcs
|
||||
fog-sakuracloud (>= 0.0.4)
|
||||
fog-serverlove
|
||||
fog-softlayer
|
||||
fog-storm_on_demand
|
||||
fog-terremark
|
||||
fog-vmfusion
|
||||
fog-voxel
|
||||
fog-vsphere (>= 0.4.0)
|
||||
fog-xenserver
|
||||
fog-xml (~> 0.1.1)
|
||||
ipaddress (~> 0.5)
|
||||
json (>= 1.8, < 2.0)
|
||||
fog-aliyun (0.3.19)
|
||||
aliyun-sdk (~> 0.8.0)
|
||||
fog-core
|
||||
fog-json
|
||||
ipaddress (~> 0.8)
|
||||
xml-simple (~> 1.1)
|
||||
fog-atmos (0.1.0)
|
||||
fog-core
|
||||
fog-xml
|
||||
fog-aws (2.0.1)
|
||||
fog-core (~> 1.38)
|
||||
fog-json (~> 1.0)
|
||||
fog-xml (~> 0.1)
|
||||
ipaddress (~> 0.8)
|
||||
fog-brightbox (0.11.0)
|
||||
fog-core (~> 1.22)
|
||||
fog-json
|
||||
inflecto (~> 0.0.2)
|
||||
fog-cloudatcost (0.1.2)
|
||||
fog-core (~> 1.36)
|
||||
fog-json (~> 1.0)
|
||||
fog-xml (~> 0.1)
|
||||
ipaddress (~> 0.8)
|
||||
fog-core (1.45.0)
|
||||
builder
|
||||
excon (~> 0.58)
|
||||
formatador (~> 0.2)
|
||||
fog-digitalocean (0.4.0)
|
||||
fog-core
|
||||
fog-json
|
||||
fog-xml
|
||||
ipaddress (>= 0.5)
|
||||
fog-dnsimple (1.0.0)
|
||||
fog-core (~> 1.38)
|
||||
fog-json (~> 1.0)
|
||||
fog-dynect (0.0.3)
|
||||
fog-core
|
||||
fog-json
|
||||
fog-xml
|
||||
fog-ecloud (0.3.0)
|
||||
fog-core
|
||||
fog-xml
|
||||
fog-google (0.1.0)
|
||||
fog-core
|
||||
fog-json
|
||||
fog-xml
|
||||
fog-internet-archive (0.0.2)
|
||||
fog-core
|
||||
fog-json
|
||||
fog-xml
|
||||
fog-joyent (0.0.1)
|
||||
fog-core (~> 1.42)
|
||||
fog-json (>= 1.0)
|
||||
fog-json (1.2.0)
|
||||
fog-core
|
||||
multi_json (~> 1.10)
|
||||
fog-local (0.6.0)
|
||||
fog-core (>= 1.27, < 3.0)
|
||||
fog-openstack (0.3.10)
|
||||
fog-core (>= 1.45, <= 2.1.0)
|
||||
fog-json (>= 1.0)
|
||||
ipaddress (>= 0.8)
|
||||
fog-powerdns (0.2.0)
|
||||
fog-core
|
||||
fog-json
|
||||
fog-xml
|
||||
fog-profitbricks (4.1.1)
|
||||
fog-core (~> 1.42)
|
||||
fog-json (~> 1.0)
|
||||
fog-rackspace (0.1.6)
|
||||
fog-core (>= 1.35)
|
||||
fog-json (>= 1.0)
|
||||
fog-xml (>= 0.1)
|
||||
ipaddress (>= 0.8)
|
||||
fog-radosgw (0.0.5)
|
||||
fog-core (>= 1.21.0)
|
||||
fog-json
|
||||
fog-xml (>= 0.0.1)
|
||||
fog-riakcs (0.1.0)
|
||||
fog-core
|
||||
fog-json
|
||||
fog-xml
|
||||
fog-sakuracloud (1.7.5)
|
||||
fog-core
|
||||
fog-json
|
||||
fog-serverlove (0.1.2)
|
||||
fog-core
|
||||
fog-json
|
||||
fog-softlayer (1.1.4)
|
||||
fog-core
|
||||
fog-json
|
||||
fog-storm_on_demand (0.1.1)
|
||||
fog-core
|
||||
fog-json
|
||||
fog-terremark (0.1.0)
|
||||
fog-core
|
||||
fog-xml
|
||||
fog-vmfusion (0.1.0)
|
||||
fission
|
||||
fog-core
|
||||
fog-voxel (0.1.0)
|
||||
fog-core
|
||||
fog-xml
|
||||
fog-vsphere (3.5.0)
|
||||
fog-core
|
||||
rbvmomi (>= 1.9, < 3)
|
||||
fog-xenserver (1.0.0)
|
||||
fog-core
|
||||
fog-xml
|
||||
xmlrpc
|
||||
fog-xml (0.1.3)
|
||||
fog-core
|
||||
nokogiri (>= 1.5.11, < 2.0.0)
|
||||
formatador (0.2.5)
|
||||
formtastic (3.1.5)
|
||||
actionpack (>= 3.2.13)
|
||||
formtastic_i18n (0.6.0)
|
||||
fpm (1.12.0)
|
||||
arr-pm (~> 0.0.10)
|
||||
backports (>= 2.6.2)
|
||||
cabin (>= 0.6.0)
|
||||
childprocess (< 1.0.0)
|
||||
clamp (~> 1.0.0)
|
||||
ffi (~> 1.12.0)
|
||||
git (>= 1.3.0, < 2.0)
|
||||
json (>= 1.7.7, < 3.0)
|
||||
pleaserun (~> 0.0.29)
|
||||
ruby-xz (~> 0.2.3)
|
||||
stud
|
||||
fugit (1.4.2)
|
||||
et-orbi (~> 1.1, >= 1.1.8)
|
||||
raabro (~> 1.4)
|
||||
geokit (1.13.1)
|
||||
geokit-rails (2.3.2)
|
||||
geokit (~> 1.5)
|
||||
rails (>= 3.0)
|
||||
git (1.8.1)
|
||||
rchardet (~> 1.8)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
gon (6.4.0)
|
||||
actionpack (>= 3.0.20)
|
||||
i18n (>= 0.7)
|
||||
multi_json
|
||||
request_store (>= 1.0)
|
||||
haml (5.2.1)
|
||||
temple (>= 0.8.0)
|
||||
tilt
|
||||
haml-rails (1.0.0)
|
||||
actionpack (>= 4.0.1)
|
||||
activesupport (>= 4.0.1)
|
||||
haml (>= 4.0.6, < 6.0)
|
||||
html2haml (>= 1.0.1)
|
||||
railties (>= 4.0.1)
|
||||
has_scope (0.7.2)
|
||||
actionpack (>= 4.1)
|
||||
activesupport (>= 4.1)
|
||||
html2haml (2.2.0)
|
||||
erubis (~> 2.7.0)
|
||||
haml (>= 4.0, < 6)
|
||||
nokogiri (>= 1.6.0)
|
||||
ruby_parser (~> 3.5)
|
||||
http-accept (1.7.0)
|
||||
http-cookie (1.0.3)
|
||||
domain_name (~> 0.5)
|
||||
httparty (0.16.2)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (0.9.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
icalendar (2.4.0)
|
||||
inflecto (0.0.2)
|
||||
influxdb (0.3.14)
|
||||
cause
|
||||
json
|
||||
influxdb-rails (0.1.12)
|
||||
influxdb (~> 0.3.0)
|
||||
railties
|
||||
inherited_resources (1.9.0)
|
||||
actionpack (>= 4.2, < 5.3)
|
||||
has_scope (~> 0.6)
|
||||
railties (>= 4.2, < 5.3)
|
||||
responders
|
||||
insist (1.0.0)
|
||||
io-like (0.3.1)
|
||||
ipaddress (0.8.3)
|
||||
iso-639 (0.3.5)
|
||||
jasmine (1.3.1)
|
||||
jasmine-core (~> 1.3.1)
|
||||
rack (~> 1.0)
|
||||
rspec (>= 1.3.1)
|
||||
selenium-webdriver (>= 0.1.3)
|
||||
jasmine-core (1.3.1)
|
||||
jquery-rails (4.4.0)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jquery-ui-rails (6.0.1)
|
||||
railties (>= 3.2.16)
|
||||
json (1.8.6)
|
||||
kaminari (1.2.1)
|
||||
activesupport (>= 4.1.0)
|
||||
kaminari-actionview (= 1.2.1)
|
||||
kaminari-activerecord (= 1.2.1)
|
||||
kaminari-core (= 1.2.1)
|
||||
kaminari-actionview (1.2.1)
|
||||
actionview
|
||||
kaminari-core (= 1.2.1)
|
||||
kaminari-activerecord (1.2.1)
|
||||
activerecord
|
||||
kaminari-core (= 1.2.1)
|
||||
kaminari-core (1.2.1)
|
||||
kgio (2.11.3)
|
||||
kickbox (2.0.4)
|
||||
faraday (~> 0.9)
|
||||
json (>= 1.8)
|
||||
launchy (2.4.3)
|
||||
addressable (~> 2.3)
|
||||
little-plugger (1.1.4)
|
||||
logging (1.7.2)
|
||||
little-plugger (>= 1.1.3)
|
||||
loofah (2.9.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
method_source (1.0.0)
|
||||
mime-types (1.25)
|
||||
mimemagic (0.3.5)
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.3)
|
||||
mono_logger (1.1.0)
|
||||
multi_json (1.15.0)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
mustache (0.99.8)
|
||||
net-ssh (6.1.0)
|
||||
netrc (0.11.0)
|
||||
nio4r (2.5.2)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
nokogumbo (2.0.4)
|
||||
nokogiri (~> 1.8, >= 1.8.4)
|
||||
oj (3.1.3)
|
||||
optimist (3.0.1)
|
||||
orm_adapter (0.5.0)
|
||||
pg (0.17.1)
|
||||
pg_array_parser (0.0.9)
|
||||
pleaserun (0.0.31)
|
||||
cabin (> 0)
|
||||
clamp
|
||||
dotenv
|
||||
insist
|
||||
mustache (= 0.99.8)
|
||||
stud
|
||||
postgres-copy (0.6.0)
|
||||
activerecord (>= 3.0.0)
|
||||
pg
|
||||
rails (>= 3.0.0)
|
||||
responders
|
||||
postgres_ext (3.0.1)
|
||||
activerecord (~> 4.0)
|
||||
arel (>= 4.0.1)
|
||||
pg_array_parser (~> 0.0.9)
|
||||
power_assert (2.0.0)
|
||||
protected_attributes (1.1.4)
|
||||
activemodel (>= 4.0.1, < 5.0)
|
||||
pry (0.14.0)
|
||||
coderay (~> 1.1)
|
||||
method_source (~> 1.0)
|
||||
pry-remote (0.1.8)
|
||||
pry (~> 0.9)
|
||||
slop (~> 3.0)
|
||||
pry-stack_explorer (0.4.12)
|
||||
binding_of_caller (~> 0.7)
|
||||
pry (~> 0.13)
|
||||
public_suffix (4.0.6)
|
||||
puma (5.2.1)
|
||||
nio4r (~> 2.0)
|
||||
raabro (1.4.0)
|
||||
rack (1.6.13)
|
||||
rack-protection (1.5.5)
|
||||
rack
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (4.2.8)
|
||||
actionmailer (= 4.2.8)
|
||||
actionpack (= 4.2.8)
|
||||
actionview (= 4.2.8)
|
||||
activejob (= 4.2.8)
|
||||
activemodel (= 4.2.8)
|
||||
activerecord (= 4.2.8)
|
||||
activesupport (= 4.2.8)
|
||||
bundler (>= 1.3.0, < 2.0)
|
||||
railties (= 4.2.8)
|
||||
sprockets-rails
|
||||
rails-deprecated_sanitizer (1.0.3)
|
||||
activesupport (>= 4.2.0.alpha)
|
||||
rails-dom-testing (1.0.9)
|
||||
activesupport (>= 4.2.0, < 5.0)
|
||||
nokogiri (~> 1.6)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.3.0)
|
||||
loofah (~> 2.3)
|
||||
rails-jquery-autocomplete (1.0.5)
|
||||
rails (>= 3.2)
|
||||
rails-observers (0.1.5)
|
||||
activemodel (>= 4.0)
|
||||
railties (4.2.8)
|
||||
actionpack (= 4.2.8)
|
||||
activesupport (= 4.2.8)
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
raindrops (0.19.1)
|
||||
rake (13.0.3)
|
||||
ransack (1.8.10)
|
||||
actionpack (>= 3.0, < 5.2)
|
||||
activerecord (>= 3.0, < 5.2)
|
||||
activesupport (>= 3.0, < 5.2)
|
||||
i18n
|
||||
rb-fsevent (0.10.4)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
rbvmomi (2.4.1)
|
||||
builder (~> 3.0)
|
||||
json (>= 1.8)
|
||||
nokogiri (~> 1.5)
|
||||
optimist (~> 3.0)
|
||||
rchardet (1.8.0)
|
||||
recurly (2.18.16)
|
||||
redis (3.3.3)
|
||||
redis-namespace (1.5.3)
|
||||
redis (~> 3.0, >= 3.0.4)
|
||||
request_store (1.5.0)
|
||||
rack (>= 1.4)
|
||||
require_all (1.5.0)
|
||||
responders (2.4.1)
|
||||
actionpack (>= 4.2.0, < 6.0)
|
||||
railties (>= 4.2.0, < 6.0)
|
||||
resque (1.27.4)
|
||||
mono_logger (~> 1.0)
|
||||
multi_json (~> 1.0)
|
||||
redis-namespace (~> 1.3)
|
||||
sinatra (>= 0.9.2)
|
||||
vegas (~> 0.1.2)
|
||||
resque-failed-job-mailer (0.0.3)
|
||||
resque-lonely_job (1.0.2)
|
||||
resque (>= 1.2)
|
||||
resque-retry (1.7.4)
|
||||
resque (>= 1.25, < 3.0)
|
||||
resque-scheduler (~> 4.0)
|
||||
resque-scheduler (4.4.0)
|
||||
mono_logger (~> 1.0)
|
||||
redis (>= 3.3)
|
||||
resque (>= 1.26)
|
||||
rufus-scheduler (~> 3.2)
|
||||
resque_mailer (2.4.3)
|
||||
actionmailer (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
rest-client (2.1.0)
|
||||
http-accept (>= 1.7.0, < 2.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
rspec (3.10.0)
|
||||
rspec-core (~> 3.10.0)
|
||||
rspec-expectations (~> 3.10.0)
|
||||
rspec-mocks (~> 3.10.0)
|
||||
rspec-core (3.10.1)
|
||||
rspec-support (~> 3.10.0)
|
||||
rspec-expectations (3.10.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.10.0)
|
||||
rspec-mocks (3.10.2)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.10.0)
|
||||
rspec-rails (4.0.2)
|
||||
actionpack (>= 4.2)
|
||||
activesupport (>= 4.2)
|
||||
railties (>= 4.2)
|
||||
rspec-core (~> 3.10)
|
||||
rspec-expectations (~> 3.10)
|
||||
rspec-mocks (~> 3.10)
|
||||
rspec-support (~> 3.10)
|
||||
rspec-support (3.10.2)
|
||||
ruby-prof (0.15.9)
|
||||
ruby-protocol-buffers (1.2.2)
|
||||
ruby-xz (0.2.3)
|
||||
ffi (~> 1.9)
|
||||
io-like (~> 0.3)
|
||||
ruby_parser (3.15.1)
|
||||
sexp_processor (~> 4.9)
|
||||
rubyzip (1.2.1)
|
||||
rufus-scheduler (3.7.0)
|
||||
fugit (~> 1.1, >= 1.1.6)
|
||||
sanitize (5.2.3)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.8.0)
|
||||
nokogumbo (~> 2.0)
|
||||
sass (3.5.5)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
sass-rails (5.0.7)
|
||||
railties (>= 4.0.0, < 6)
|
||||
sass (~> 3.1)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
select2-rails (4.0.13)
|
||||
selenium-webdriver (3.14.0)
|
||||
childprocess (~> 0.5)
|
||||
rubyzip (~> 1.2)
|
||||
sendgrid (1.2.0)
|
||||
json
|
||||
sendgrid_toolkit (1.4.0)
|
||||
httparty (>= 0.7.6)
|
||||
sexp_processor (4.15.2)
|
||||
simplecov (0.7.1)
|
||||
multi_json (~> 1.0)
|
||||
simplecov-html (~> 0.7.1)
|
||||
simplecov-html (0.7.1)
|
||||
simplecov-rcov (0.2.3)
|
||||
simplecov (>= 0.4.1)
|
||||
sinatra (1.4.8)
|
||||
rack (~> 1.5)
|
||||
rack-protection (~> 1.4)
|
||||
tilt (>= 1.3, < 3)
|
||||
slim (4.1.0)
|
||||
temple (>= 0.7.6, < 0.9)
|
||||
tilt (>= 2.0.6, < 2.1)
|
||||
slop (3.6.0)
|
||||
sprockets (3.6.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (2.3.2)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
stripe (5.29.1)
|
||||
stud (0.0.23)
|
||||
temple (0.8.2)
|
||||
test-unit (3.4.0)
|
||||
power_assert
|
||||
thor (1.1.0)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.10)
|
||||
tzinfo (1.2.9)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unf (0.1.3)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.7)
|
||||
unicorn (5.8.0)
|
||||
kgio (~> 2.6)
|
||||
raindrops (~> 0.7)
|
||||
uuidtools (2.1.2)
|
||||
vegas (0.1.11)
|
||||
rack (>= 1.0.0)
|
||||
warden (1.2.7)
|
||||
rack (>= 1.0)
|
||||
webrick (1.7.0)
|
||||
will_paginate (3.3.0)
|
||||
xdan-datetimepicker-rails (2.5.4)
|
||||
jquery-rails
|
||||
rails (>= 3.2.16)
|
||||
xml-simple (1.1.8)
|
||||
xmlrpc (0.3.2)
|
||||
webrick
|
||||
xpath (2.1.0)
|
||||
nokogiri (~> 1.3)
|
||||
zip-codes (0.2.1)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
aasm
|
||||
activeadmin
|
||||
activeadmin-searchable_select
|
||||
activeadmin_addons
|
||||
amqp (= 0.9.8)
|
||||
auto_strip_attributes (= 2.6.0)
|
||||
aws-sdk (~> 1)
|
||||
bcrypt (= 3.1.15)
|
||||
best_in_place
|
||||
bootstrap-sass (= 2.0.4)
|
||||
bootstrap-will_paginate (= 0.0.6)
|
||||
bugsnag (= 5.3.2)
|
||||
capybara (= 2.13.0)
|
||||
carrierwave (= 0.11.2)
|
||||
carrierwave_direct
|
||||
cocoon
|
||||
coffee-rails
|
||||
coffee-script-source
|
||||
country-select
|
||||
database_cleaner
|
||||
devise
|
||||
elasticsearch
|
||||
email_validator (= 1.6.0)
|
||||
eventmachine (= 1.2.3)
|
||||
execjs (= 1.4.0)
|
||||
factory_girl_rails
|
||||
faker (= 1.3.0)
|
||||
faraday (= 0.9.2)
|
||||
fog
|
||||
fog-brightbox (= 0.11.0)
|
||||
fpm
|
||||
geokit-rails
|
||||
gon
|
||||
haml-rails
|
||||
icalendar (= 2.4.0)
|
||||
influxdb (= 0.3.14)
|
||||
influxdb-rails (= 0.1.12)
|
||||
iso-639
|
||||
jam_ruby!
|
||||
jampb!
|
||||
jasmine (= 1.3.1)
|
||||
jquery-rails
|
||||
jquery-ui-rails
|
||||
json (= 1.8.6)
|
||||
kickbox
|
||||
launchy (= 2.4.3)
|
||||
logging (= 1.7.2)
|
||||
mime-types (= 1.25)
|
||||
net-ssh
|
||||
nokogiri (= 1.10.10)
|
||||
oj (= 3.1.3)
|
||||
pg (= 0.17.1)
|
||||
postgres-copy (= 0.6.0)
|
||||
postgres_ext
|
||||
protected_attributes
|
||||
pry
|
||||
pry-remote
|
||||
pry-stack_explorer
|
||||
puma
|
||||
rails (= 4.2.8)
|
||||
rails-jquery-autocomplete
|
||||
rails-observers
|
||||
recurly (= 2.18.16)
|
||||
redis (= 3.3.3)
|
||||
redis-namespace (= 1.5.3)
|
||||
resque
|
||||
resque-failed-job-mailer
|
||||
resque-lonely_job (~> 1.0.0)
|
||||
resque-retry
|
||||
resque_mailer
|
||||
rest-client
|
||||
rspec-rails
|
||||
ruby-prof (= 0.15.9)
|
||||
ruby-protocol-buffers (= 1.2.2)
|
||||
rubyzip (= 1.2.1)
|
||||
sanitize
|
||||
sass (= 3.5.5)
|
||||
sass-rails (= 5.0.7)
|
||||
sendgrid (= 1.2.0)
|
||||
sendgrid_toolkit (>= 1.1.1)
|
||||
simplecov (~> 0.7.1)
|
||||
simplecov-rcov
|
||||
slim
|
||||
sprockets (= 3.6.3)
|
||||
sprockets-rails (= 2.3.2)
|
||||
stripe
|
||||
test-unit
|
||||
uglifier
|
||||
unf (= 0.1.3)
|
||||
unicorn
|
||||
uuidtools (= 2.1.2)
|
||||
will_paginate
|
||||
xmlrpc
|
||||
zip-codes
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.4.1p111
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
||||
|
|
@ -8,12 +8,3 @@ Immediately the focus is on using active_scaffolding that provides visibility in
|
|||
Overtime we can add more administrative functions and views, but initially this is one of the easiest ways to give 'powertools' behind the scenes with an entirely separate authentication model.
|
||||
|
||||
|
||||
|
||||
Examples of:
|
||||
|
||||
* Button on Show Page of Item: 'Send Client Update Notice' in jam_ruby_artifact_updates.rb
|
||||
* Batch Updates in View page: onboarding.rb (CurrentlyOnboarding)
|
||||
|
||||
|
||||
Stuff that is probably breaky:
|
||||
activeadmin_addons https://github.com/platanus/activeadmin_addons
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#!/usr/bin/env rake
|
||||
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||
|
|
@ -6,9 +5,3 @@
|
|||
require File.expand_path('../config/application', __FILE__)
|
||||
|
||||
JamAdmin::Application.load_tasks
|
||||
|
||||
require 'jam_ruby'
|
||||
|
||||
spec = Gem::Specification.find_by_name 'jam_ruby'
|
||||
rakefile = "#{spec.gem_dir}/Rakefile"
|
||||
load rakefile
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
module AdCampaignsHelper
|
||||
def self.spacer(val, total)
|
||||
percentage = ((val * 100) / total.to_f).round(1).to_s
|
||||
('%-5.5s' % percentage).gsub(' ', ' ') + '% - ' + val.to_s
|
||||
end
|
||||
|
||||
def self.cac(campaign)
|
||||
if campaign.subscribed && campaign.subscribed > 0
|
||||
(campaign.spend/campaign.subscribed.to_f).round(2)
|
||||
end
|
||||
end
|
||||
|
||||
def self.cac_divide_by_ltv(campaign)
|
||||
customer_ltv = GenericState.singleton.customer_ltv
|
||||
if cac(campaign) && customer_ltv && customer_ltv > 0
|
||||
return (cac(campaign)/customer_ltv.to_f).round(2)
|
||||
end
|
||||
end
|
||||
|
||||
def self.format_number(num)
|
||||
if num
|
||||
num.to_s.reverse.scan(/\d{3}|.+/).join(",").reverse
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
ActiveAdmin.register JamRuby::AdCampaign, as: 'AdCampaign' do
|
||||
menu :label => 'Ad Campaigns', :parent => 'Reports'
|
||||
before_filter :skip_sidebar!, :only => :index
|
||||
config.batch_actions = false
|
||||
config.clear_action_items!
|
||||
config.sort_order = "users.origin_utm_campaign DESC"
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
|
||||
|
||||
index do
|
||||
div do
|
||||
render 'customer_ltv'
|
||||
end
|
||||
|
||||
column "Campaign" do |campaign|
|
||||
campaign.origin_utm_campaign
|
||||
end
|
||||
column "Medium" do |campaign|
|
||||
campaign.origin_utm_medium
|
||||
end
|
||||
column "End Date" do |campaign|
|
||||
best_in_place campaign, :end_date, as: :date, url: inplace_update_admin_ad_campaigns_path(campaign: campaign.origin_utm_campaign, medium: campaign.origin_utm_medium), param: 'ad_campaign', classes: 'ac_bip'
|
||||
end
|
||||
column "Hard Date" do |campaign|
|
||||
(campaign.end_date + 45.days).strftime('%Y-%m-%d') if campaign.end_date.present?
|
||||
end
|
||||
column "Subscribed" do |campaign|
|
||||
raw(AdCampaignsHelper.spacer(campaign.subscribed, campaign.joined))
|
||||
end
|
||||
column "Spend" do |campaign|
|
||||
best_in_place campaign, :spend, as: :input, url: inplace_update_admin_ad_campaigns_path(campaign: campaign.origin_utm_campaign, medium: campaign.origin_utm_medium), param: 'ad_campaign', display_with: Proc.new{|spend| number_to_currency(spend) }, classes: 'ac_bip'
|
||||
end
|
||||
column "CAC" do |campaign|
|
||||
number_to_currency(AdCampaignsHelper.cac(campaign)) if AdCampaignsHelper.cac(campaign) && AdCampaignsHelper.cac(campaign) > 0
|
||||
end
|
||||
column "LTV/CAC" do |campaign|
|
||||
AdCampaignsHelper.cac_divide_by_ltv(campaign)
|
||||
end
|
||||
column "Referred" do |campaign|
|
||||
best_in_place campaign, :referred, as: :input, url: inplace_update_admin_ad_campaigns_path(campaign: campaign.origin_utm_campaign, medium: campaign.origin_utm_medium), param: 'ad_campaign', display_with: Proc.new{|referred| AdCampaignsHelper.format_number(referred) }, classes: 'ac_bip'
|
||||
end
|
||||
column "Signed Up" do |campaign|
|
||||
if campaign.referred && campaign.referred > 0
|
||||
raw(AdCampaignsHelper.spacer(campaign.joined, campaign.referred))
|
||||
else
|
||||
raw("? - #{campaign.joined}")
|
||||
end
|
||||
end
|
||||
column "Downloaded" do |campaign|
|
||||
raw(AdCampaignsHelper.spacer(campaign.downloaded, campaign.joined))
|
||||
end
|
||||
column "Ran Client" do |campaign|
|
||||
raw(AdCampaignsHelper.spacer(campaign.ran_client, campaign.joined))
|
||||
end
|
||||
column "FTUE" do |campaign|
|
||||
raw(AdCampaignsHelper.spacer(campaign.ftue, campaign.joined))
|
||||
end
|
||||
column "Any Session" do |campaign|
|
||||
raw(AdCampaignsHelper.spacer(campaign.any_session, campaign.joined))
|
||||
end
|
||||
column "2+ Session" do |campaign|
|
||||
raw(AdCampaignsHelper.spacer(campaign.real_session, campaign.joined))
|
||||
end
|
||||
column "Good Session" do |campaign|
|
||||
raw(AdCampaignsHelper.spacer(campaign.good_session, campaign.joined))
|
||||
end
|
||||
column "Invited" do |campaign|
|
||||
raw(AdCampaignsHelper.spacer(campaign.invited, campaign.joined))
|
||||
end
|
||||
column "Friended" do |campaign|
|
||||
raw(AdCampaignsHelper.spacer(campaign.friended, campaign.joined))
|
||||
end
|
||||
column "Platinum" do |campaign|
|
||||
campaign.platinum
|
||||
end
|
||||
column "Gold" do |campaign|
|
||||
campaign.gold
|
||||
end
|
||||
column "Silver" do |campaign|
|
||||
campaign.silver
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
controller do
|
||||
def scoped_collection
|
||||
User.select("users.origin_utm_campaign,
|
||||
users.origin_utm_medium, COUNT(users.id) AS joined,
|
||||
COUNT(users.first_downloaded_client_at) AS downloaded,
|
||||
COUNT(users.first_subscribed_at) AS subscribed,
|
||||
COUNT(users.first_ran_client_at) AS ran_client,
|
||||
COUNT(users.first_certified_gear_at) AS ftue,
|
||||
COUNT(users.first_music_session_at) AS any_session,
|
||||
COUNT(users.first_real_music_session_at) AS real_session,
|
||||
COUNT(users.first_good_music_session_at) AS good_session,
|
||||
COUNT(users.first_invited_at) AS invited,
|
||||
COUNT(users.first_friended_at) AS friended,
|
||||
COUNT(CASE WHEN users.first_subscribed_plan_code = 'jamsubplatinum' OR users.first_subscribed_plan_code = 'jamsubplatinumyearly' THEN users.first_subscribed_plan_code END) AS platinum,
|
||||
COUNT(CASE WHEN users.first_subscribed_plan_code = 'jamsubgold' OR users.first_subscribed_plan_code = 'jamsubgoldyearly' THEN users.first_subscribed_plan_code END) AS gold,
|
||||
COUNT(CASE WHEN users.first_subscribed_plan_code = 'jamsubsilver' OR users.first_subscribed_plan_code = 'jamsubsilveryearly' THEN users.first_subscribed_plan_code END) AS silver,
|
||||
ad_campaigns.id,
|
||||
COALESCE(MAX(ad_campaigns.referred), NULL) as referred,
|
||||
COALESCE(MAX(ad_campaigns.end_date), NULL) AS end_date,
|
||||
COALESCE(MAX(ad_campaigns.spend), 0) AS spend").joins("
|
||||
LEFT JOIN ad_campaigns ON users.origin_utm_campaign = ad_campaigns.campaign
|
||||
AND users.origin_utm_medium = ad_campaigns.medium").where("
|
||||
users.origin_utm_campaign IS NOT NULL AND users.origin_utm_medium IS NOT NULL AND users.origin_utm_source = 'paid'").group("
|
||||
ad_campaigns.id, users.origin_utm_campaign, users.origin_utm_medium").order("
|
||||
users.origin_utm_campaign DESC")
|
||||
end
|
||||
|
||||
|
||||
def permitted_params
|
||||
params.permit :campaign, :medium, :_method, ad_campaign: [:spend, :referred, :end_date]
|
||||
end
|
||||
end
|
||||
|
||||
collection_action :inplace_update, method: :put do
|
||||
campaign = permitted_params[:campaign]
|
||||
medium = permitted_params[:medium]
|
||||
@ad_campaign = JamRuby::AdCampaign.where(campaign: campaign, medium: medium).first_or_create
|
||||
respond_to do |format|
|
||||
if @ad_campaign.update_attributes(permitted_params[:ad_campaign])
|
||||
format.json { head :ok }
|
||||
else
|
||||
format.json{ render :json => @ad_campaign.errors.full_messages, :status => :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
# module AdCampaignsHelper
|
||||
# def campaign_brought_in_users(campaign, medium)
|
||||
# User.where(origin_utm_campaign: campaign, origin_utm_medium: medium)
|
||||
# end
|
||||
# end
|
||||
|
||||
# ActiveAdmin.register JamRuby::AdCampaign do
|
||||
# permit_params :campaign, :medium, :spend
|
||||
# end
|
||||
|
||||
# ActiveAdmin.register_page "Ad campaigns" do
|
||||
# menu parent: 'Reports'
|
||||
# content :title => "Paid Advertising Report" do
|
||||
# table_for User.select("users.origin_utm_campaign, users.origin_utm_medium, COALESCE(MAX(ad_campaigns.end_date), NULL) AS end_date, COALESCE(MAX(ad_campaigns.spend), NULL) AS spend").joins("LEFT JOIN ad_campaigns ON users.origin_utm_campaign = ad_campaigns.campaign AND users.origin_utm_medium = ad_campaigns.medium").group("ad_campaigns.id, users.origin_utm_campaign, users.origin_utm_medium") do
|
||||
# column "Campaign" do |campaign|
|
||||
# campaign.origin_utm_campaign
|
||||
# end
|
||||
# column "Medium" do |campaign|
|
||||
# campaign.origin_utm_medium
|
||||
# end
|
||||
# column "End Date" do |campaign|
|
||||
# campaign.end_date
|
||||
# end
|
||||
# column "Hard Date" do |campaign|
|
||||
# campaign.end_date + 45.days if campaign.end_date.present?
|
||||
# end
|
||||
# column "Subscribed" do |campaign|
|
||||
# end
|
||||
# column "Spend" do |campaign|
|
||||
# best_in_place campaign, :spend, as: :input, url: admin_ad_campaigns_update_path(campaign: campaign.origin_utm_campaign, medium: campaign.origin_utm_medium), param: 'ad_campaign'
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# page_action :update, method: :put do
|
||||
# campaign = params[:campaign]
|
||||
# medium = params[:medium]
|
||||
# ad_campaign = AdCampaign.where(campaign: campaign, medium: medium).first_or_initialize
|
||||
# ad_campaign.attributes = params["ad_campaign"]
|
||||
# ad_campaign.save!
|
||||
# respond_with_bip(ad_campaign)
|
||||
# end
|
||||
# end
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
class AffiliateCohortsHelper
|
||||
def self.percentage(opTop, opBottom)
|
||||
"#{(opTop/opBottom * 100).round(1)}%"
|
||||
end
|
||||
|
||||
def self.quarter(date)
|
||||
case date.month
|
||||
when 1, 2, 3 then 0
|
||||
when 4, 5, 6 then 1
|
||||
when 7, 8, 9 then 2
|
||||
when 10, 11, 12 then 3
|
||||
end
|
||||
end
|
||||
|
||||
def self.payments_for_months(affiliate_partner, year, start_month, end_month)
|
||||
JamRuby::AffiliateMonthlyPayment.where(
|
||||
"affiliate_partner_id = ? AND month >= ? AND month <= ? AND year = ?",
|
||||
affiliate_partner.id,
|
||||
start_month,
|
||||
end_month,
|
||||
year
|
||||
).order('month DESC')
|
||||
end
|
||||
|
||||
def self.payments_for_quarter(affiliate_partner, year, quarter)
|
||||
JamRuby::AffiliateQuarterlyPayment.where(
|
||||
"affiliate_partner_id = ? AND quarter = ? AND year = ?",
|
||||
affiliate_partner.id,
|
||||
quarter,
|
||||
year
|
||||
).order('quarter DESC')
|
||||
end
|
||||
|
||||
def self.all_time_payments(affiliate_partner)
|
||||
JamRuby::AffiliateQuarterlyPayment.where(
|
||||
"affiliate_partner_id = ?", affiliate_partner.id
|
||||
)
|
||||
end
|
||||
|
||||
def self.current_quarter_payments(affiliate_partner)
|
||||
AffiliateCohortsHelper.payments_for_quarter(affiliate_partner,
|
||||
Date.today.year,
|
||||
AffiliateCohortsHelper.quarter(Date.today)
|
||||
)
|
||||
end
|
||||
|
||||
def self.current_quarter_monthly_payments(affiliate_partner)
|
||||
AffiliateCohortsHelper.payments_for_months(affiliate_partner,
|
||||
Date.today.beginning_of_quarter.year,
|
||||
Date.today.beginning_of_quarter.month,
|
||||
Date.today.end_of_quarter.month
|
||||
)
|
||||
end
|
||||
|
||||
def self.prior_quarter_payments(affiliate_partner)
|
||||
prev_quarter_start = (Date.today.beginning_of_quarter - 1.day).beginning_of_quarter
|
||||
prev_quarter = AffiliateCohortsHelper.quarter(prev_quarter_start)
|
||||
AffiliateCohortsHelper.payments_for_quarter(affiliate_partner,
|
||||
prev_quarter_start.year,
|
||||
prev_quarter
|
||||
)
|
||||
end
|
||||
|
||||
def self.prior_quarter_payable_amount(affiliate_partner)
|
||||
total = AffiliateCohortsHelper.prior_quarter_payments(affiliate_partner).inject(0.0){ | sum, payment |
|
||||
sum += payment.due_amount_in_cents }
|
||||
paid = AffiliateCohortsHelper.prior_quarter_payments(affiliate_partner).where(paid: false).inject(0.0){ | sum, payment |
|
||||
sum += payment.due_amount_in_cents }
|
||||
(total - paid) / 100.0
|
||||
end
|
||||
end
|
||||
|
||||
ActiveAdmin.register_page "Affiliate Cohorts" do
|
||||
menu parent: 'Reports'
|
||||
|
||||
content :title => "Affiliate Cohorts" do
|
||||
table_for AffiliatePartner.includes(:partner_user).all do
|
||||
column 'Affiliate Name' do |partner|
|
||||
link_to partner.partner_name, admin_affiliate_path(partner)
|
||||
end
|
||||
column 'Affiliate ID', :id
|
||||
column 'Affiliate Email', Proc.new{ | partner | partner&.partner_user&.email}
|
||||
column 'Affiliate Paypal', Proc.new{| partner | partner.paypal_id }
|
||||
column 'All Time Users', :referral_user_count
|
||||
column 'All Time Subscribers', Proc.new{ | partner | partner.subscribed_user_referrals.size }
|
||||
column 'All Time Subscriber Conversion Rate', Proc.new{ | partner |
|
||||
AffiliateCohortsHelper.percentage(partner.subscribed_user_referrals.size.to_f, partner.referral_user_count.to_f) }
|
||||
column 'All Time Revenues', Proc.new{ | partner |
|
||||
number_to_currency(AffiliateCohortsHelper.all_time_payments(partner).inject(0.0){ | sum, payment | sum += payment.due_amount_in_cents } / 100.0)
|
||||
}
|
||||
column 'Current Quarter Revenues', Proc.new{ | partner |
|
||||
number_to_currency(AffiliateCohortsHelper.current_quarter_payments(partner).inject(0.0){ | sum, payment | sum += payment.due_amount_in_cents } / 100.0 )
|
||||
}
|
||||
column 'Current Quarter Revenues by Month', Proc.new{ | partner |
|
||||
AffiliateCohortsHelper.current_quarter_monthly_payments(partner).each do |monthly_payment|
|
||||
li "#{Date::MONTHNAMES[monthly_payment.month]} #{monthly_payment.year} - #{number_to_currency(monthly_payment.due_amount_in_cents.to_f / 100.0)}"
|
||||
end
|
||||
''.html_safe
|
||||
}
|
||||
column 'Prior Quarter Revenues', Proc.new{ | partner |
|
||||
number_to_currency(AffiliateCohortsHelper.prior_quarter_payments(partner).inject(0.0){ | sum, payment | sum += payment.due_amount_in_cents } / 100.0)
|
||||
}
|
||||
column 'Prior Quarter Payable', Proc.new{ | partner |
|
||||
number_to_currency(AffiliateCohortsHelper.prior_quarter_payable_amount(partner))
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::AffiliateLink, :as => 'Affiliate Links' do
|
||||
|
||||
menu :label => 'Links', :parent => 'Affiliates'
|
||||
|
||||
config.sort_order = 'created_at ASC'
|
||||
config.batch_actions = false
|
||||
# config.clear_action_items!
|
||||
config.filters = false
|
||||
config.per_page = 50
|
||||
config.paginate = true
|
||||
|
||||
#form :partial => 'form'
|
||||
|
||||
|
||||
form do |f|
|
||||
f.inputs 'Fields' do
|
||||
f.input(:name, :input_html => { :maxlength => 255 })
|
||||
f.input(:link, :input_html => { :maxlength => 255 })
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
|
||||
index do
|
||||
|
||||
column 'Name' do |oo|
|
||||
oo.name
|
||||
end
|
||||
column 'Link' do |oo|
|
||||
oo.link
|
||||
end
|
||||
actions
|
||||
end
|
||||
end
|
||||
|
|
@ -2,7 +2,7 @@ ActiveAdmin.register JamRuby::AffiliateQuarterlyPayment, :as => 'Affiliate Quart
|
|||
|
||||
menu :label => 'Quarterly Reports', :parent => 'Affiliates'
|
||||
|
||||
config.sort_order = 'year desc, quarter desc, due_amount_in_cents desc'
|
||||
config.sort_order = 'due_amount_in_cents DESC'
|
||||
config.batch_actions = false
|
||||
config.clear_action_items!
|
||||
config.filters = true
|
||||
|
|
@ -14,32 +14,18 @@ ActiveAdmin.register JamRuby::AffiliateQuarterlyPayment, :as => 'Affiliate Quart
|
|||
filter :quarter
|
||||
filter :closed
|
||||
filter :paid
|
||||
filter :jamtracks_sold
|
||||
filter :subscriptions_count
|
||||
filter :due_amount_in_cents
|
||||
|
||||
form :partial => 'form'
|
||||
|
||||
scope("Sorted By Due Amount", default: true) { |scope| scope.order('year desc, quarter desc, due_amount_in_cents desc') }
|
||||
scope("Sorted By Jamtracks Sold", default: false) { |scope| scope.order('year desc, quarter desc, jamtracks_sold desc') }
|
||||
scope("Sorted By Subs", default: false) { |scope| scope.order('year desc, quarter desc, subscriptions_count desc') }
|
||||
scope("Sorted By Newest First") { |scope| scope.order('year desc, quarter desc, id desc') }
|
||||
scope("Any") { |scope| scope.order('year desc, quarter desc, due_amount_in_cents desc') }
|
||||
|
||||
|
||||
index do
|
||||
|
||||
# default_actions # use this for all view/edit/delete links
|
||||
|
||||
column 'Year' do |oo| oo.year end
|
||||
column 'Quarter' do |oo| oo.quarter end
|
||||
column 'Partner Id' do |oo| oo.affiliate_partner.id end
|
||||
column 'Partner' do |oo| link_to(oo.affiliate_partner.display_name, oo.affiliate_partner.admin_url, {:title => oo.affiliate_partner.display_name}) end
|
||||
column "Tot ($)" do |oo| sprintf("$%.2f", oo.due_amount_in_cents.to_f / 100.to_f) end
|
||||
column "Sub ($)" do |oo| sprintf("$%.2f", oo.subscription_due_amount_in_cents.to_f / 100.to_f) end
|
||||
column "Jam ($)" do |oo| sprintf("$%.2f", oo.jamtrack_due_amount_in_cents.to_f / 100.to_f) end
|
||||
column 'JamTracks' do |oo| oo.jamtracks_sold end
|
||||
column 'Subscriptions' do |oo| oo.subscriptions_count end
|
||||
column "Due (\u00A2)" do |oo| oo.due_amount_in_cents end
|
||||
column 'JamTracks Sold' do |oo| oo.jamtracks_sold end
|
||||
column 'Paid' do |oo| oo.paid end
|
||||
column 'Closed' do |oo| oo.paid end
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,7 @@ ActiveAdmin.register JamRuby::AffiliateTrafficTotal, :as => 'Affiliate Daily Sta
|
|||
# default_actions # use this for all view/edit/delete links
|
||||
|
||||
column 'Day' do |oo| oo.day end
|
||||
column 'Partner ID' do |oo| oo.affiliate_partner.id end
|
||||
column 'Partner Name' do |oo| oo.affiliate_partner.display_name end
|
||||
column 'Partner User' do |oo| link_to(oo.affiliate_partner.partner_user.name, admin_user_path(oo.affiliate_partner.partner_user.id), { :title => oo.affiliate_partner.partner_user.name }) end
|
||||
column 'Partner' do |oo| link_to(oo.affiliate_partner.display_name, oo.affiliate_partner.admin_url, {:title => oo.affiliate_partner.display_name}) end
|
||||
column 'Signups' do |oo| oo.signups end
|
||||
column 'Visits' do |oo| oo.visits end
|
||||
|
||||
|
|
@ -33,16 +31,6 @@ ActiveAdmin.register JamRuby::AffiliateTrafficTotal, :as => 'Affiliate Daily Sta
|
|||
|
||||
|
||||
controller do
|
||||
def scoped_collection
|
||||
rel = end_of_association_chain
|
||||
.includes([:affiliate_partner])
|
||||
.order('day DESC')
|
||||
if (ref_id = params[AffiliatePartner::PARAM_REFERRAL]).present?
|
||||
qq = ['affiliate_partner_id = ?', ref_id]
|
||||
else
|
||||
qq = ['affiliate_partner_id IS NOT NULL']
|
||||
end
|
||||
@users ||= rel.where(qq)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,32 +8,27 @@ ActiveAdmin.register JamRuby::User, :as => 'Referrals' do
|
|||
config.filters = true
|
||||
|
||||
filter :affiliate_referral
|
||||
filter :email
|
||||
|
||||
## scope("Has Signups", default: true) { |scope| scope.where('visits != 0 or signups != 0').order('day desc') }
|
||||
|
||||
index do
|
||||
column 'User' do |oo| link_to(oo.name, oo.admin_url, {:title => oo.name}) end
|
||||
column 'User Email' do |oo| oo.email end
|
||||
column 'Email' do |oo| oo.email end
|
||||
column 'Created' do |oo| oo.created_at end
|
||||
column 'Partner ID' do |oo| oo.affiliate_referral.id end
|
||||
column 'Partner Name' do |oo| oo.affiliate_referral.display_name end
|
||||
column 'Partner User' do |oo| link_to(oo.affiliate_referral.partner_user.name, admin_user_path(oo.affiliate_referral.partner_user.id), { :title => oo.affiliate_referral.partner_user.name }) end
|
||||
column 'Partner' do |oo| oo.affiliate_referral.display_name end
|
||||
end
|
||||
|
||||
controller do
|
||||
|
||||
def scoped_collection
|
||||
rel = end_of_association_chain
|
||||
.includes([:affiliate_referral])
|
||||
.order('created_at DESC')
|
||||
if (ref_id = params[AffiliatePartner::PARAM_REFERRAL]).present?
|
||||
qq = ['affiliate_referral_id = ?', ref_id]
|
||||
else
|
||||
qq = ['affiliate_referral_id IS NOT NULL']
|
||||
def scoped_collection
|
||||
rel = end_of_association_chain
|
||||
.includes([:affiliate_referral])
|
||||
.order('created_at DESC')
|
||||
if (ref_id = params[AffiliatePartner::PARAM_REFERRAL]).present?
|
||||
qq = ['affiliate_referral_id = ?', ref_id]
|
||||
else
|
||||
qq = ['affiliate_referral_id IS NOT NULL']
|
||||
end
|
||||
@users ||= rel.where(qq)
|
||||
end
|
||||
@users ||= rel.where(qq)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,136 +5,33 @@ ActiveAdmin.register JamRuby::AffiliatePartner, :as => 'Affiliates' do
|
|||
config.sort_order = 'referral_user_count DESC'
|
||||
config.batch_actions = false
|
||||
# config.clear_action_items!
|
||||
config.filters = true
|
||||
config.per_page = 100
|
||||
config.filters = false
|
||||
config.per_page = 50
|
||||
config.paginate = true
|
||||
|
||||
#form :partial => 'form'
|
||||
form :partial => 'form'
|
||||
|
||||
|
||||
#filter :partner_user
|
||||
filter :partner_name
|
||||
filter :id
|
||||
filter :current_quarter_in_cents
|
||||
filter :cumulative_earnings_in_cents
|
||||
filter :jamtracks_sold
|
||||
filter :subscriptions_count
|
||||
filter :referral_user_count
|
||||
|
||||
scope("Sorted By Current Quarter", default: true) { |scope| scope.where('partner_user_id IS NOT NULL').order('current_quarter_in_cents desc') }
|
||||
scope("Sorted By Jamtracks Sold", default: false) { |scope| scope.where('partner_user_id IS NOT NULL').order('jamtracks_sold desc') }
|
||||
scope("Sorted By Subs", default: false) { |scope| scope.where('partner_user_id IS NOT NULL').order('subscriptions_count desc') }
|
||||
scope("Sorted By Signups", default: false) { |scope| scope.where('partner_user_id IS NOT NULL').order('referral_user_count desc') }
|
||||
scope("Sorted By Newest First") { |scope| scope.where('partner_user_id IS NOT NULL').order('id desc') }
|
||||
scope("Any") { |scope| scope.where('partner_user_id IS NOT NULL').order('referral_user_count desc') }
|
||||
scope("Active", default: true) { |scope| scope.where('partner_user_id IS NOT NULL').order('referral_user_count desc') }
|
||||
scope("Unpaid") { |partner| partner.unpaid }
|
||||
|
||||
controller do
|
||||
helper 'active_admin/subscription'
|
||||
end
|
||||
|
||||
|
||||
form do |f|
|
||||
f.inputs 'Fields' do
|
||||
f.input(:partner_name, :input_html => { :maxlength => 128 })
|
||||
f.input(:partner_user, as: :searchable_select, hint: 'This person is the owner of the affiliate. Has access to reporting info in account section of www.jamkazam.com')
|
||||
f.input(:entity_type, :as => :select, :collection => AffiliatePartner::ENTITY_TYPES)
|
||||
f.input(:rate)
|
||||
f.input(:paypal_id)
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
|
||||
index do
|
||||
|
||||
# actions # use this for all view/edit/delete links
|
||||
# default_actions # use this for all view/edit/delete links
|
||||
|
||||
column 'User' do |oo|
|
||||
link_to(oo.partner_user.name, admin_user_path(oo.partner_user.id), { :title => oo.partner_user.name })
|
||||
end
|
||||
column 'Name' do |oo|
|
||||
oo.partner_name
|
||||
end
|
||||
column 'Type' do |oo|
|
||||
oo.entity_type
|
||||
end
|
||||
column 'Code' do |oo|
|
||||
oo.id
|
||||
end
|
||||
column 'Signups' do |oo|
|
||||
oo.referral_user_count
|
||||
end
|
||||
column 'JamTracks' do |oo|
|
||||
oo.jamtracks_sold
|
||||
end
|
||||
column 'Subs' do |oo|
|
||||
oo.subscriptions_count
|
||||
end
|
||||
column 'Cum Earnings' do |oo|
|
||||
div do
|
||||
sprintf("Tot $%.2f", oo.cumulative_earnings_in_dollars)
|
||||
end
|
||||
div do
|
||||
sprintf("Jam $%.2f", oo.jamtrack_cumulative_earnings_in_dollars)
|
||||
end
|
||||
div do
|
||||
sprintf("Sub $%.2f", oo.subscriptions_cumulative_earnings_in_dollars)
|
||||
end
|
||||
end
|
||||
column 'Current Quarter' do |oo|
|
||||
div do
|
||||
sprintf("Tot $%.2f", oo.current_quarter_in_dollars)
|
||||
end
|
||||
div do
|
||||
sprintf("Jam $%.2f", oo.jamtrack_current_quarter_in_dollars)
|
||||
end
|
||||
div do
|
||||
sprintf("Sub $%.2f", oo.subscriptions_current_quarter_in_dollars)
|
||||
end
|
||||
end
|
||||
column 'Amount Owed' do |oo|
|
||||
div do
|
||||
sprintf("Tot $%.2f", oo.due_amount_in_cents.to_f / 100.to_f)
|
||||
end
|
||||
div do
|
||||
sprintf("Jam $%.2f", oo.jamtrack_due_amount_in_cents.to_f / 100.to_f)
|
||||
end
|
||||
div do
|
||||
sprintf("Sub $%.2f", oo.subscription_due_amount_in_cents.to_f / 100.to_f)
|
||||
end
|
||||
end
|
||||
column 'User' do |oo| link_to(oo.partner_user.name, admin_user_path(oo.partner_user.id), {:title => oo.partner_user.name}) end
|
||||
column 'Name' do |oo| oo.partner_name end
|
||||
column 'Type' do |oo| oo.entity_type end
|
||||
column 'Code' do |oo| oo.id end
|
||||
column 'Referral Count' do |oo| oo.referral_user_count end
|
||||
column 'Earnings' do |oo| sprintf("$%.2f", oo.cumulative_earnings_in_dollars) end
|
||||
column 'Amount Owed' do |oo| sprintf("$%.2f", oo.due_amount_in_cents.to_f / 100.to_f) end
|
||||
column 'Pay Actions' do |oo|
|
||||
link_to('Mark Paid', mark_paid_admin_affiliate_path(oo.id), :confirm => "Mark this affiliate as PAID?") if oo.unpaid
|
||||
end
|
||||
|
||||
actions
|
||||
default_actions
|
||||
end
|
||||
|
||||
show do |affiliate_partner|
|
||||
|
||||
attributes_table do
|
||||
row :id
|
||||
row :partner_name
|
||||
row :entity_type
|
||||
row :rate
|
||||
row :address
|
||||
row :tax_identifier
|
||||
row :paypal_id
|
||||
row :venmo_user_id
|
||||
row :jamtracks_sold
|
||||
row :subscriptions_count
|
||||
row :cumulative_earnings_in_dollars
|
||||
row :jamtrack_cumulative_earnings_in_dollars
|
||||
row :subscriptions_cumulative_earnings_in_dollars
|
||||
row :current_quarter_in_dollars
|
||||
row :jamtrack_current_quarter_in_dollars
|
||||
row :subscriptions_current_quarter_in_dollars
|
||||
end
|
||||
|
||||
|
||||
render 'earnings', { affiliate_partner: affiliate_partner }
|
||||
|
||||
end
|
||||
|
||||
action_item :only => [:show] do
|
||||
link_to("Mark Paid",
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::AppFeature, as: 'App Features' do
|
||||
|
||||
menu parent: 'Misc', label: 'App Features'
|
||||
|
||||
config.sort_order = 'created_at ASC'
|
||||
config.batch_actions = false
|
||||
config.filters = false
|
||||
config.per_page = 50
|
||||
config.paginate = true
|
||||
|
||||
form do |f|
|
||||
f.inputs 'Fields' do
|
||||
f.input(:feature_type, as: :select, collection: JamRuby::AppFeature::FEATURE_TYPES)
|
||||
f.input(:handle, :input_html => { :maxlength => 1025 })
|
||||
f.input(:is_enabled, as: :boolean)
|
||||
f.input(:env, as: :select, collection: %w(production staging development))
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::Ars, :as => 'Ars' do
|
||||
|
||||
menu :label => 'NAS', :parent => 'Operations'
|
||||
|
||||
|
||||
form do |f|
|
||||
f.inputs 'Controls' do
|
||||
f.input :active
|
||||
f.input :beta
|
||||
end
|
||||
f.inputs 'Meta' do
|
||||
f.input :name
|
||||
f.input :provider
|
||||
f.input :id_int
|
||||
f.input :ip
|
||||
f.input :username
|
||||
f.input :password, as: :string
|
||||
f.input :port
|
||||
f.input :continent
|
||||
f.input :country, as: :string
|
||||
f.input :city
|
||||
f.input :subdivision
|
||||
f.input :latitude
|
||||
f.input :longitude
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
ActiveAdmin.register JamRuby::Band, :as => 'Band' do
|
||||
menu :label => 'Bands', :parent => 'Misc'
|
||||
|
||||
collection_action :autocomplete_band_name, :method => :get
|
||||
|
||||
controller do
|
||||
|
|
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
ActiveAdmin.register_page "CampaignSpend" do
|
||||
menu :parent => 'JamClass'
|
||||
|
||||
page_action :create_spend, :method => :post do
|
||||
|
||||
campaign = params[:jam_ruby_campaign_spend][:campaign]
|
||||
year = params[:jam_ruby_campaign_spend][:year]
|
||||
month = params[:jam_ruby_campaign_spend][:month]
|
||||
spend = params[:jam_ruby_campaign_spend][:spend]
|
||||
|
||||
if campaign.blank?
|
||||
redirect_to admin_campaignspend_path, :notice => "No campaign defined! Nothing done."
|
||||
return
|
||||
elsif spend.blank?
|
||||
redirect_to admin_campaignspend_path, :notice => "No spend defined! Nothing done."
|
||||
return
|
||||
elsif year.blank? || month.blank?
|
||||
spend = spend.to_f
|
||||
# get all cohorts for a given campaign
|
||||
campaign_cohorts = JamClassReport.where(campaign: campaign).where("cohort IS NOT NULL")
|
||||
year_months = []
|
||||
campaign_cohorts.each do |cohort|
|
||||
year_month = {year: cohort.cohort.year, month: cohort.cohort.month}
|
||||
year_months << year_month
|
||||
end
|
||||
|
||||
if campaign_cohorts.length > 0
|
||||
per_month = spend / campaign_cohorts.length
|
||||
year_months.each do |year_month|
|
||||
campaign_spend = CampaignSpend.where(campaign: campaign).where(year: year_month[:year]).where(month: year_month[:month]).first
|
||||
|
||||
if campaign_spend.nil?
|
||||
campaign_spend = CampaignSpend.new
|
||||
end
|
||||
campaign_spend.campaign = campaign
|
||||
campaign_spend.month = year_month[:month]
|
||||
campaign_spend.year = year_month[:year]
|
||||
campaign_spend.spend = per_month
|
||||
|
||||
campaign_spend.save!
|
||||
|
||||
end
|
||||
else
|
||||
redirect_to admin_campaignspend_path, :notice => "No data found for campaign: #{campaign}"
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
redirect_to admin_campaignspend_path, :notice => "Campaign #{campaign} updated with a per month value of $#{per_month} (#{year_months.length} months worth of data found)"
|
||||
else
|
||||
campaign_spend = CampaignSpend.where(campaign: campaign).where(year: year).where(month: month).first
|
||||
|
||||
if campaign_spend.nil?
|
||||
campaign_spend = CampaignSpend.new
|
||||
end
|
||||
campaign_spend.campaign = campaign
|
||||
campaign_spend.month = month
|
||||
campaign_spend.year = year
|
||||
campaign_spend.spend = spend
|
||||
|
||||
campaign_spend.save!
|
||||
|
||||
redirect_to admin_campaignspend_path, :notice => "Campaign spend updated: #{campaign}:#{year}-#{month} = $#{spend}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
content do
|
||||
|
||||
para do
|
||||
link_to "JamClass Report", admin_jamclassreports_path
|
||||
end
|
||||
para do
|
||||
semantic_form_for CampaignSpend.new, :url => admin_campaignspend_create_spend_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
f.inputs "Campaign Spend" do
|
||||
f.input :spend, :required => true, hint: "If you leave year or month blank, the system will divide up the specified spend amount here across all months seen for this campaign."
|
||||
f.input :campaign, :as => :select, hint: "If this appears empty or incomplete, visit the JamClass Report page (link above) and come back.", :required => true, :collection => JamClassReport.select('campaign').group('campaign').map(&:campaign)
|
||||
f.input :year, :as => :select, :hint => "Year of campaign spend (optional)", :collection => [Date.today.year, Date.today.year - 1]
|
||||
f.input :month, :as => :select, :hint => "Month of campaign (optional)", :collection => (1..12).map { |m| [Date::MONTHNAMES[m], m] }
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::Charge, :as => 'Charges' do
|
||||
|
||||
menu :label => 'Charge', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = true
|
||||
|
||||
controller do
|
||||
active_admin_config.includes.push :user
|
||||
end
|
||||
|
||||
filter :user_email_cont, label: 'Name', as: :string
|
||||
|
||||
index do
|
||||
column "Actions" do |charge|
|
||||
links = ''.html_safe
|
||||
links << link_to("View", resource_path(charge), :class => "member_link view_link")
|
||||
links << link_to("Edit", edit_resource_path(charge), :class => "member_link edit_link")
|
||||
links
|
||||
end
|
||||
column "User" do |charge|
|
||||
link_to charge.user.name, charge.user.admin_url
|
||||
end
|
||||
column :billed
|
||||
column :billing_error_reason
|
||||
column :billing_attempts
|
||||
column :amount_in_cents
|
||||
column :fee_in_cents
|
||||
column :created_at
|
||||
column :updated_at
|
||||
column "Stripe" do |charge|
|
||||
link_to "Link", "https://dashboard.stripe.com/payments/#{charge.stripe_charge_id}" if charge.stripe_charge_id
|
||||
end
|
||||
end
|
||||
|
||||
show do
|
||||
attributes_table do
|
||||
row "User" do |charge|
|
||||
link_to charge.user.name, charge.user.admin_url
|
||||
end
|
||||
row :amount_in_cents
|
||||
row :fee_in_cents
|
||||
row :billed
|
||||
row :billed_at
|
||||
row :post_processed
|
||||
row :post_processed_at
|
||||
row :billing_error_reason
|
||||
row :billing_error_detail
|
||||
row :billing_should_retry
|
||||
row :billing_attempts
|
||||
row :stripe_charge_id
|
||||
row :created_at
|
||||
row :updated_at
|
||||
row "Stripe" do |charge|
|
||||
link_to "Link", "https://dashboard.stripe.com/payments/#{charge.stripe_charge_id}" if charge.stripe_charge_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -56,7 +56,7 @@ ActiveAdmin.register JamRuby::Connection, :as => 'Connection' do
|
|||
end
|
||||
|
||||
index do
|
||||
actions
|
||||
default_actions
|
||||
column :user_id do |c|
|
||||
c.user ? c.user.name : ''
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ ActiveAdmin.register JamRuby::CrashDump, :as => 'Crash Dump' do
|
|||
column 'User' do |oo| oo.user ? link_to(oo.user.email, oo.user.admin_url, {:title => oo.user.email}) : '' end
|
||||
column "Client Version", :client_version
|
||||
column "Client Type", :client_type
|
||||
column "Crash Context", :crash_context
|
||||
column "File Size", :fsize
|
||||
column "Download" do |post|
|
||||
link_to 'Link', post.sign_url
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ ActiveAdmin.register_page "Dashboard" do
|
|||
content :title => proc{ I18n.t("active_admin.dashboard") } do
|
||||
div :class => "blank_slate_container", :id => "dashboard_default_message" do
|
||||
span :class => "blank_slate" do
|
||||
span "JamKazam Administration Portal"
|
||||
span "JamKazam Data Administration Portal"
|
||||
small ul do
|
||||
li link_to "Users", admin_users_path
|
||||
li link_to "K12 Users", admin_users_path("q[import_source_equals]": "K12")
|
||||
li link_to "Teachers", admin_teachers_path
|
||||
li link_to "Upload School Users", admin_schooluseruploads_path
|
||||
|
||||
li "Admin users are users with the admin boolean set to true"
|
||||
li "Invite JamKazam users using the 'Users > Invite' menu in header"
|
||||
li "Admin users are created/deleted when toggling the 'admin' flag for JamKazam users"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ ActiveAdmin.register JamRuby::EmailBatch, :as => 'Batch Emails' do
|
|||
link_to("Clone", batch_clone_admin_batch_email_path(bb.id))
|
||||
end
|
||||
|
||||
actions
|
||||
default_actions
|
||||
end
|
||||
|
||||
show :title => 'Batch Email' do |obj|
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::EventBriteOrder, :as => 'EventBriteOrder' do
|
||||
menu :parent => 'Misc'
|
||||
|
||||
config.sort_order = 'created_at DESC'
|
||||
|
||||
filter :live_stream
|
||||
filter :email
|
||||
filter :order_id
|
||||
|
||||
end
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
ActiveAdmin.register_page "EventBriteOrderUploads" do
|
||||
|
||||
menu :label => 'Event Brite Order Upload', :parent => 'Misc'
|
||||
|
||||
page_action :upload_eventbriteorders, :method => :post do
|
||||
EventBriteOrder.transaction do
|
||||
|
||||
puts params
|
||||
|
||||
|
||||
live_stream = LiveStream.find_by_id!(params[:jam_ruby_event_brite_order][:live_stream_id])
|
||||
|
||||
file = params[:jam_ruby_event_brite_order][:csv]
|
||||
|
||||
upload = EventBriteOrderUpload.new
|
||||
upload.upload_file_name = file.original_filename
|
||||
upload.save!
|
||||
|
||||
array_of_arrays = CSV.read(file.tempfile.path, headers:true)
|
||||
array_of_arrays.each do |row|
|
||||
order_id = row['Order ID']
|
||||
|
||||
event_brite_order = EventBriteOrder.find_by_order_id(order_id)
|
||||
if event_brite_order.nil?
|
||||
event_brite_order = EventBriteOrder.new
|
||||
end
|
||||
event_brite_order.event_brite_order_upload = upload
|
||||
event_brite_order.live_stream = live_stream
|
||||
event_brite_order.event_name = row['Event Name']
|
||||
event_brite_order.order_id = order_id
|
||||
event_brite_order.ticket_count = row['Tickets']
|
||||
event_brite_order.ticket_type = row['Type']
|
||||
event_brite_order.first_name = row['First Name']
|
||||
event_brite_order.last_name = row['Last Name']
|
||||
event_brite_order.email = row['Email Address']
|
||||
event_brite_order.save!
|
||||
end
|
||||
|
||||
redirect_to admin_eventbriteorderuploads_path, :notice => "Created #{array_of_arrays.length} event brite orders!"
|
||||
end
|
||||
end
|
||||
content do
|
||||
active_admin_form_for EventBriteOrder.new, :url => admin_eventbriteorderuploads_upload_eventbriteorders_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
f.inputs "Upload Event Brite Orders" do
|
||||
f.input :csv, as: :file, required: true, :label => "An event brite order CSV exactly as exported from Eventbrite"
|
||||
f.input :live_stream, required:true, as: :select, :collection => LiveStream.upcoming
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -27,12 +27,12 @@ ActiveAdmin.register_page "Fake Purchaser" do
|
|||
count = 0
|
||||
JamTrack.all.each do |jam_track|
|
||||
unless jam_track.right_for_user(user)
|
||||
|
||||
jam_track_right=JamTrackRight.new
|
||||
jam_track_right.user = user
|
||||
jam_track_right.jam_track = jam_track
|
||||
jam_track_right.is_test_purchase = true
|
||||
jam_track_right.version = jam_track.version
|
||||
jam_track_right.can_download = true
|
||||
jam_track_right.save!
|
||||
count = count + 1
|
||||
end
|
||||
|
|
@ -42,11 +42,12 @@ ActiveAdmin.register_page "Fake Purchaser" do
|
|||
end
|
||||
|
||||
content do
|
||||
active_admin_form_for JamTrackRight.new, :url => admin_fake_purchaser_bulk_jamtrack_purchase_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
inputs "Admin User to Fake JamTrack Purchases" do
|
||||
input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path, :input_html => { :id_element => "#jam_trak_right_user_id" }, hint: 'All JamTracks in the system will be \'bought\' for this user. No Recurly interaction occurs with this feature.'
|
||||
|
||||
semantic_form_for JamTrackRight.new, :url => admin_fake_purchaser_bulk_jamtrack_purchase_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
f.inputs "Admin User to Fake JamTrack Purchases" do
|
||||
f.input :user, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path, :input_html => { :id_element => "#jam_trak_right_user_id" }, hint: 'All JamTracks in the system will be \'bought\' for this user. No Recurly interaction occurs with this feature.'
|
||||
end
|
||||
actions
|
||||
f.actions
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ ActiveAdmin.register JamRuby::FraudAlert, :as => 'Fraud Alerts' do
|
|||
scope.joins('INNER JOIN "machine_fingerprints" ON "machine_fingerprints"."id" = "fraud_alerts"."machine_fingerprint_id" LEFT OUTER JOIN "fingerprint_whitelists" ON "fingerprint_whitelists"."fingerprint" = "machine_fingerprints"."fingerprint"').where('fingerprint_whitelists IS NULL')}
|
||||
|
||||
index do
|
||||
actions
|
||||
default_actions
|
||||
|
||||
column :machine_fingerprint
|
||||
column :user
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::GenericState, :as => 'GenericState' do
|
||||
menu :parent => 'Operations'
|
||||
|
||||
config.clear_action_items!
|
||||
filter :env
|
||||
permit_params :top_message, :event_page_top_logo_url, :customer_ltv, :connection_policy
|
||||
|
||||
actions :all, :except => [:destroy]
|
||||
|
||||
index do
|
||||
selectable_column
|
||||
column :env
|
||||
actions
|
||||
end
|
||||
|
||||
form :partial => 'form'
|
||||
|
||||
end
|
||||
|
|
@ -28,7 +28,7 @@ ActiveAdmin.register_page "Giftcarduploads" do
|
|||
end
|
||||
|
||||
content do
|
||||
active_admin_form_for GiftCard.new, :url => admin_giftcarduploads_upload_giftcards_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
semantic_form_for GiftCard.new, :url => admin_giftcarduploads_upload_giftcards_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
f.inputs "Upload Gift Cards" do
|
||||
f.input :csv, as: :file, required: true, :label => "A single column CSV that contains ONE type of gift card (5 JamTrack, 10 JamTrack, etc)"
|
||||
f.input :card_type, required:true, as: :select, :collection => JamRuby::GiftCard::CARD_TYPES
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ ActiveAdmin.register_page "Bootstrap" do
|
|||
para "You need to create at least one server template, and one mount template. Click one of the top-left buttons based on your platform"
|
||||
|
||||
elsif IcecastMountTemplate.count == 0
|
||||
active_admin_form_for IcecastMountTemplate.new, :url => admin_bootstrap_create_mount_template_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
semantic_form_for IcecastMountTemplate.new, :url => admin_bootstrap_create_mount_template_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
f.inputs "New Mount Template" do
|
||||
f.input :hostname, :label => "jam-web public hostname:port (such that icecast can reach it)"
|
||||
f.input :default_mime_type, :as => :select, :collection => ["ogg", "mp3"]
|
||||
|
|
@ -228,7 +228,7 @@ ActiveAdmin.register_page "Bootstrap" do
|
|||
f.actions
|
||||
end
|
||||
else
|
||||
active_admin_form_for IcecastServer.new, :url => admin_bootstrap_create_server_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
semantic_form_for IcecastServer.new, :url => admin_bootstrap_create_server_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
f.inputs "New Icecast Server" do
|
||||
f.input :hostname, :hint => "Just the icecast hostname; no port"
|
||||
f.input :template, :hint => "This is the template associated with the server. Not as useful for the 1st server, but subsequent servers can use this same template, and share config"
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::User, :as => 'InactiveJamClassUsers' do
|
||||
|
||||
menu :label => 'Inactive JamClass Users w/o Credits', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = false
|
||||
|
||||
scope("All", default: true) { |scope| scope.includes(:taken_lessons => :music_session).select("distinct(users.id), users.email, users.first_name, users.last_name").joins("inner join posa_cards on posa_cards.user_id = users.id inner join lesson_sessions on lesson_sessions.user_id = users.id left outer join music_sessions on music_sessions.lesson_session_id = music_sessions.id ").where("jamclass_credits = 0") }
|
||||
|
||||
index do
|
||||
column "Name" do |user|
|
||||
span do
|
||||
link_to "#{user.name} (#{user.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{user.id}"
|
||||
end
|
||||
end
|
||||
column "POSA" do |user|
|
||||
span do
|
||||
posa = user.posa_cards[0]
|
||||
if posa.lesson_package_type
|
||||
posa.lesson_package_type.id
|
||||
else
|
||||
posa.card_type
|
||||
end
|
||||
end
|
||||
end
|
||||
column "Last Session" do |user|
|
||||
span do
|
||||
if user.taken_lessons.length == 0
|
||||
"none yet"
|
||||
else
|
||||
most_recent_lesson = user.taken_lessons.order('created_at desc')[0]
|
||||
link_to most_recent_lesson.scheduled_start, admin_lesson_session_path(most_recent_lesson)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::User, :as => 'InactiveJamClassPOSAUsers' do
|
||||
|
||||
menu :label => 'Inactive JamClass Users w/ Credits', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = false
|
||||
|
||||
scope("All", default: true) { |scope| scope.includes(:taken_lessons => :music_session).select("distinct(users.id), users.email, users.first_name, users.last_name, users.jamclass_credits").joins("inner join posa_cards on posa_cards.user_id = users.id left outer join lesson_sessions on lesson_sessions.user_id = users.id left outer join music_sessions on music_sessions.lesson_session_id = music_sessions.id ").where("jamclass_credits > 0 AND music_sessions.id IS NULL OR music_sessions.scheduled_start < ?", Time.now - 7.days) }
|
||||
|
||||
index do
|
||||
column "Name" do |user|
|
||||
span do
|
||||
link_to "#{user.name} (#{user.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{user.id}"
|
||||
end
|
||||
end
|
||||
column "POSA" do |user|
|
||||
span do
|
||||
posa = user.posa_cards[0]
|
||||
if posa.lesson_package_type
|
||||
posa.lesson_package_type.id
|
||||
else
|
||||
posa.card_type
|
||||
end
|
||||
end
|
||||
end
|
||||
column "Credits" do |user|
|
||||
span do
|
||||
user.jamclass_credits
|
||||
end
|
||||
end
|
||||
column "Last Session" do |user|
|
||||
span do
|
||||
if user.taken_lessons.length == 0
|
||||
"none yet"
|
||||
else
|
||||
most_recent_lesson = user.taken_lessons.order('created_at desc')[0]
|
||||
link_to most_recent_lesson.scheduled_start, admin_lesson_session_path(most_recent_lesson)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::User, :as => 'EducationInterest' do
|
||||
|
||||
menu :label => 'Interested in Education', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = false
|
||||
|
||||
scope("All", default: true) { |scope| scope.where(education_interest: true) }
|
||||
|
||||
index do
|
||||
column "Name" do |user|
|
||||
span do
|
||||
link_to "#{user.name} (#{user.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{user.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::User, :as => 'RetailerInterest' do
|
||||
|
||||
menu :label => 'Interested in Retailers', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = false
|
||||
|
||||
scope("All", default: true) { |scope| scope.where(retailer_interest: true) }
|
||||
|
||||
index do
|
||||
column "Name" do |user|
|
||||
span do
|
||||
link_to "#{user.name} (#{user.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{user.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::User, :as => 'SchoolInterest' do
|
||||
|
||||
menu :label => 'Interested in Schools', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = false
|
||||
|
||||
scope("All", default: true) { |scope| scope.where(school_interest: true) }
|
||||
|
||||
index do
|
||||
column "Name" do |user|
|
||||
span do
|
||||
link_to "#{user.name} (#{user.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{user.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
ActiveAdmin.register_page "Jam Class Knobs" do
|
||||
menu :parent => 'JamClass'
|
||||
|
||||
page_action :force_hourly, :method => :post do
|
||||
|
||||
Resque.enqueue(HourlyJob)
|
||||
redirect_to admin_jam_class_knobs_path, :notice => "Re-running the Hourly Job. Lessons will be analysed; any payments will be attempted that should be, etc"
|
||||
end
|
||||
|
||||
|
||||
action_item do
|
||||
link_to "Force Hourly Background Job", admin_jam_class_knobs_force_hourly_path, :method => :post
|
||||
end
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
ActiveAdmin.register_page "Monthly Roll Forward", as: "JamClass Monthly Roll Forward" do
|
||||
menu :parent => 'JamClass'
|
||||
|
||||
content :title => "JamClass Monthly Roll Forwards" do
|
||||
para do
|
||||
table_for JamClassReport.roll_forward_bookings do
|
||||
|
||||
column "Student" do |r|
|
||||
r.student.admin_name
|
||||
end
|
||||
column "Teacher" do |r|
|
||||
r.teacher.admin_name
|
||||
end
|
||||
column "Booking Active?" do |r|
|
||||
r.active ? 'Y' : 'N'
|
||||
end
|
||||
column "Booking Status" do |r|
|
||||
link_to r.status, admin_lesson_booking_path(r.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
ActiveAdmin.register_page "JamClassReports", as: "JamClass Cohort Report" do
|
||||
menu :parent => 'JamClass'
|
||||
|
||||
content :title => "JamClass Report" do
|
||||
para do
|
||||
link_to "Campaign Spend", admin_campaignspend_path
|
||||
end
|
||||
para do
|
||||
table_for JamClassReport.analyse do
|
||||
|
||||
column "Campaign" do |r|
|
||||
if r.campaign.nil?
|
||||
"N/A"
|
||||
else
|
||||
r.campaign
|
||||
end
|
||||
end
|
||||
column "Cohort" do |r|
|
||||
if r.cohort.nil?
|
||||
"Total"
|
||||
else
|
||||
"#{Date::ABBR_MONTHNAMES[r.cohort.month]} #{r.cohort.year}"
|
||||
end
|
||||
end
|
||||
column "Spend" do |r|
|
||||
if r.spend.nil?
|
||||
"N/A"
|
||||
else
|
||||
r.spend
|
||||
end
|
||||
end
|
||||
column "Registrations", :registrations
|
||||
column "TD Customers", :td_customers
|
||||
column "JamClass Revenues", :jamclass_rev
|
||||
column "TD4", :td4
|
||||
column "TD2", :td2
|
||||
column "TD1", :td1
|
||||
column "Spend/TD" do |r|
|
||||
if r.spend_td.nil?
|
||||
"N/A"
|
||||
else
|
||||
r.spend_td
|
||||
end
|
||||
end
|
||||
column "% 0 BC" do |r|
|
||||
(r.purchases0 * 100).round
|
||||
end
|
||||
column "% 1 BC" do |r|
|
||||
(r.purchases1 * 100).round
|
||||
end
|
||||
column "% 2 BC" do |r|
|
||||
(r.purchases2 * 100).round
|
||||
end
|
||||
column "% 3 BC" do |r|
|
||||
(r.purchases3 * 100).round
|
||||
end
|
||||
column "% 4+ BC" do |r|
|
||||
(r.purchases_rest * 100).round
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -17,9 +17,11 @@ ActiveAdmin.register JamRuby::ArtifactUpdate, :as => 'Artifacts' do
|
|||
f.input :uri, :as => :file, :hint => "Upload the artifact from Jenkins"
|
||||
end
|
||||
|
||||
f.actions
|
||||
f.buttons
|
||||
|
||||
end
|
||||
|
||||
|
||||
action_item :only => [:show] do
|
||||
link_to('Send Client Update Notice', send_client_update_notice_admin_artifact_path(resource.id))
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,651 +1,84 @@
|
|||
ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
||||
|
||||
searchable_select_options(scope: User.all,
|
||||
text_attribute: :username,
|
||||
filter: lambda do |term, scope|
|
||||
scope.ransack(full_name_or_email_cont: term).result
|
||||
end)
|
||||
|
||||
collection_action :autocomplete_user_email, :method => :get
|
||||
|
||||
actions :all, :except => [:destroy]
|
||||
|
||||
menu :label => 'Users', :parent => 'Users'
|
||||
|
||||
config.sort_order = 'created_at DESC'
|
||||
|
||||
filter :jamuser_full_name_or_email_cont, label: 'Name Or Email', as: :string
|
||||
filter :email
|
||||
filter :first_name
|
||||
filter :last_name
|
||||
filter :created_at
|
||||
filter :updated_at
|
||||
filter :import_source
|
||||
|
||||
includes :purchased_jam_tracks, :jam_track_rights => :jam_track, :taken_lessons => :music_session, :taught_lessons => :music_session
|
||||
|
||||
form :partial => "form"
|
||||
|
||||
action_item :school_user, only: :index do
|
||||
link_to "Quick Add School User", add_school_user_admin_users_path
|
||||
end
|
||||
|
||||
action_item :latency, only: :show do
|
||||
link_to 'Show Latency', latency_admin_user_path(resource)
|
||||
end
|
||||
|
||||
collection_action :add_school_user, method: [:get, :post] do
|
||||
if request.post?
|
||||
@client = RecurlyClient.new
|
||||
errors = []
|
||||
user_params = params[:jam_ruby_user]
|
||||
|
||||
user_type = user_params[:user_type].strip
|
||||
school_id = user_params[:school_id].strip
|
||||
|
||||
return (render text: "Please select school") if school_id.blank?
|
||||
|
||||
first_name = user_params[:first_name].strip
|
||||
last_name = user_params[:last_name].strip
|
||||
email = user_params[:email].strip.downcase
|
||||
license_start = user_params[:license_start].strip
|
||||
license_end = user_params[:license_end].strip
|
||||
import_source = user_params[:import_source].strip
|
||||
password = SecureRandom.uuid
|
||||
|
||||
options = {
|
||||
first_name: first_name,
|
||||
last_name: last_name,
|
||||
email: email,
|
||||
license_start: license_start,
|
||||
license_end: license_end,
|
||||
import_source: import_source,
|
||||
terms_of_service: true,
|
||||
musician: true,
|
||||
skip_recaptcha: true,
|
||||
password: password,
|
||||
password_confirmation: password
|
||||
}
|
||||
options.merge!({ school_id: school_id }) if school_id.present?
|
||||
|
||||
instrument = Instrument.find('electric guitar')
|
||||
instruments = [{instrument_id: instrument.id, proficiency_level: 3, priority: 1}]
|
||||
options[:instruments] = instruments
|
||||
|
||||
parse_user_type(user_type, options)
|
||||
|
||||
@user = User.find_by_email(options[:email])
|
||||
|
||||
unless @user.nil?
|
||||
@user.user_type = user_type
|
||||
#if @user.import_source.nil?
|
||||
#TODO: do we need to have following 3 lines for an existing user?
|
||||
@user.import_source = options[:import_source]
|
||||
@user.license_start = options[:license_start]
|
||||
@user.license_end = options[:license_end]
|
||||
|
||||
if options[:student]
|
||||
@user.school_id = options[:school_id]
|
||||
@user.is_a_student = true
|
||||
elsif options[:teacher]
|
||||
@user.school = school
|
||||
if @user.teacher.nil?
|
||||
@user.teacher = Teacher.build_teacher(@user, validate_introduction: true, biography: "Empty biography", school_id: school.id)
|
||||
end
|
||||
elsif options[:platform_instructor]
|
||||
@user.is_platform_instructor = true
|
||||
end
|
||||
|
||||
if @user.save
|
||||
@client.sync_subscription(@user)
|
||||
if options[:student]
|
||||
UserMailer.school_welcome_message(@user, nil).deliver_now
|
||||
elsif options[:teacher]
|
||||
UserMailer.school_welcome_message(@user, nil).deliver_now
|
||||
elsif options[:platform_instructor]
|
||||
end
|
||||
end
|
||||
if @user.errors.any?
|
||||
flash[:error] = "Error updating User #{@user.name} #{@user.email}"
|
||||
render :add_school_user
|
||||
else
|
||||
flash[:notice] = "User #{@user.name} #{@user.email} updated successfully"
|
||||
redirect_to admin_users_path
|
||||
end
|
||||
#end
|
||||
else
|
||||
@user = User.signup(options)
|
||||
|
||||
if @user.errors.none?
|
||||
@client.sync_subscription(@user)
|
||||
puts "User #{@user.email} created"
|
||||
flash[:notice] = "User #{@user.name} #{@user.email} added successfully"
|
||||
redirect_to admin_users_path
|
||||
else
|
||||
flash[:error] = "Error adding school user"
|
||||
render :add_school_user
|
||||
end
|
||||
end
|
||||
else
|
||||
@user = User.new
|
||||
@user.import_source = 'Manual'
|
||||
end
|
||||
end
|
||||
|
||||
member_action :update_school_user, method: [:get, :put] do
|
||||
|
||||
end
|
||||
|
||||
member_action :delete_forever, :method => :get do
|
||||
resource.permanently_delete
|
||||
redirect_to :back, {notice: 'User email and login credentials have been permanently changed'}
|
||||
end
|
||||
|
||||
|
||||
#Notification.send_reload(connection.client_id)
|
||||
|
||||
member_action :give_free_plan, :method => :get do
|
||||
@client = RecurlyClient.new
|
||||
plan_code = params[:plan_code]
|
||||
if params[:plan_code] == ''
|
||||
plan_code = nil
|
||||
end
|
||||
|
||||
resource.update_admin_override_plan_code(plan_code)
|
||||
redirect_to :back, {notice: "User got a free plan via adminstrative override to #{params[:plan_code]}"}
|
||||
end
|
||||
|
||||
member_action :revoke_free_plan, :method => :get do
|
||||
resource.update_admin_override_plan_code(nil)
|
||||
redirect_to :back, {notice: "User has administrative free plan removed"}
|
||||
end
|
||||
|
||||
|
||||
member_action :resend_welcome_email, :method => :get do
|
||||
user = resource
|
||||
if user.is_a_student
|
||||
if user.import_source
|
||||
reset_url = resource.create_tokened_reset_url
|
||||
UserMailer.school_welcome_message(user, reset_url).deliver_now
|
||||
else
|
||||
UserMailer.student_welcome_message(user).deliver_now
|
||||
end
|
||||
elsif user.is_a_teacher
|
||||
if user.import_source
|
||||
reset_url = resource.create_tokened_reset_url
|
||||
UserMailer.school_welcome_message(user, reset_url).deliver_now
|
||||
else
|
||||
UserMailer.teacher_welcome_message(user).deliver_now
|
||||
end
|
||||
elsif user.is_platform_instructor
|
||||
reset_url = resource.create_tokened_reset_url
|
||||
UserMailer.welcome_message(user, reset_url).deliver_now
|
||||
else
|
||||
UserMailer.welcome_message(user).deliver_now
|
||||
end
|
||||
|
||||
redirect_to :back, {notice: "Resent Welcome Email"}
|
||||
end
|
||||
|
||||
member_action :sync_subscription, :method => :get do
|
||||
@client = RecurlyClient.new
|
||||
@client.sync_subscription(resource)
|
||||
redirect_to :back, {notice: "Check the Subscription Plan Code, Subscription Sync Code, Subscription Sync Msg"}
|
||||
end
|
||||
|
||||
member_action :reset_monthly_play, :method => :get do
|
||||
resource.used_month_play_time = 0
|
||||
resource.save!
|
||||
redirect_to :back, {notice: "Reset user's monthly play time to 0"}
|
||||
end
|
||||
|
||||
member_action :change_to_plan, :method => :get do
|
||||
@client = RecurlyClient.new
|
||||
plan_code = params[:plan_code]
|
||||
if params[:plan_code] == ''
|
||||
plan_code = nil
|
||||
end
|
||||
|
||||
result, subscription, account = @client.update_desired_subscription(resource, plan_code)
|
||||
redirect_to :back, {notice: "Set user's desired plan. "}
|
||||
end
|
||||
member_action :quick_reset, :method => :get do
|
||||
resetting_to = 'jellyandjam123'
|
||||
resource.change_password(resetting_to, resetting_to)
|
||||
resource.save
|
||||
redirect_to :back, {notice: "Reset password to #{resetting_to }"}
|
||||
end
|
||||
|
||||
member_action :create_reset, :method => :get do
|
||||
reset_url = resource.create_tokened_reset_url
|
||||
redirect_to :back, {notice: "Reset password url created: #{reset_url}"}
|
||||
end
|
||||
|
||||
member_action :end_trial, :method => :get do
|
||||
if Time.now - 2.days < resource.subscription_trial_ends_at
|
||||
resource.subscription_trial_ends_at = 3.days.ago
|
||||
resource.save!
|
||||
redirect_to :back, {notice: "User's trial ended"}
|
||||
else
|
||||
redirect_to :back, {notice: "Users trial already ended > 2 days ago. Left alone user account"}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
member_action :latency, method: :get do
|
||||
@user = resource
|
||||
latency_url = "#{Rails.application.config.latency_data_host}/user/#{@user.id}"
|
||||
uri = URI(latency_url)
|
||||
begin
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.use_ssl = true if Rails.application.config.latency_data_host.start_with?("https://")
|
||||
req = Net::HTTP::Get.new(uri.request_uri)
|
||||
req["Authorization"] = "Basic #{Rails.application.config.latency_data_host_auth_code}"
|
||||
req["Content-Type"] = "application/json"
|
||||
|
||||
response = http.request(req)
|
||||
|
||||
render text: "404 Not Found", status: 404 if response.is_a?(Net::HTTPNotFound)
|
||||
#render json: response.body, status: 200 if response.is_a?(Net::HTTPOK) || response.is_a?(Net::HTTPSuccess)
|
||||
@user_latency = response.body
|
||||
rescue => e
|
||||
render text: e.message
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
show do |user|
|
||||
panel "Common" do
|
||||
attributes_table do
|
||||
row :id
|
||||
row :email
|
||||
row :admin
|
||||
row :updated_at
|
||||
row :created_at
|
||||
row :musician
|
||||
row :city
|
||||
row :state
|
||||
row :country
|
||||
row :first_name
|
||||
row :last_name
|
||||
row :birth_date
|
||||
row :gender
|
||||
row :email_confirmed
|
||||
row :remember_token
|
||||
=begin
|
||||
row "Session Ready" do |user|
|
||||
div do
|
||||
if user.ready_for_session_at
|
||||
span do
|
||||
'YES'
|
||||
end
|
||||
span do
|
||||
br
|
||||
end
|
||||
span do
|
||||
link_to("mark as not checked", mark_session_not_ready_admin_student_path(user.id), {confirm: "Mark as not ready for session?"})
|
||||
end
|
||||
else
|
||||
span do
|
||||
'NO'
|
||||
end
|
||||
span do
|
||||
br
|
||||
end
|
||||
span do
|
||||
link_to("mark as checked", mark_session_ready_admin_student_path(user.id), {confirm: "Mark as ready for session?"})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
=end
|
||||
row "Delete Forever" do |user|
|
||||
span do
|
||||
link_to("delete forever", delete_forever_admin_user_path(user.id), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
end
|
||||
|
||||
row "Quick Password Reset" do |user|
|
||||
span do
|
||||
link_to("reset password to jellyandjam123", quick_reset_admin_user_path(user.id), :data => {:confirm => 'Reset password to jellyandjam123 ?'})
|
||||
end
|
||||
end
|
||||
|
||||
row "Send Password Reset Email" do |user|
|
||||
span do
|
||||
Rails.application.config.external_root_url + "/request_reset_password"
|
||||
end
|
||||
end
|
||||
|
||||
row "Password Reset URL" do |user|
|
||||
span do
|
||||
link_to("create reset URL", create_reset_admin_user_path(user.id), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
end
|
||||
|
||||
row "Resend Welcome Email" do |user|
|
||||
span do
|
||||
link_to("resend welcome email", resend_welcome_email_admin_user_path(user.id), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
end
|
||||
|
||||
row "Subscription" do |user|
|
||||
div do
|
||||
attributes_table do
|
||||
row :subscription_plan_code
|
||||
row :desired_plan_code
|
||||
row :admin_override_plan_code
|
||||
row :admin_override_ends_at
|
||||
row :recurly_subscription_state
|
||||
row :recurly_subscription_id
|
||||
row :desired_plan_code_set_at
|
||||
row :subscription_plan_code_set_at
|
||||
row :subscription_last_checked_at
|
||||
row :subscription_trial_ends_at
|
||||
row :subscription_sync_code
|
||||
row :subscription_sync_msg
|
||||
row :is_past_due
|
||||
row :stored_credit_card
|
||||
row "Monthly Time Used" do |user|
|
||||
div do
|
||||
remaining_month_play_time = user.subscription_rules[:remaining_month_play_time]
|
||||
if remaining_month_play_time.nil?
|
||||
span do
|
||||
"No limit"
|
||||
end
|
||||
elsif user.played_this_month?
|
||||
span do
|
||||
"Used: #{user.used_month_play_time / 60} min | Remaining #{remaining_month_play_time / 60} min"
|
||||
end
|
||||
else
|
||||
span do
|
||||
"Did not play this month. Last played #{user.used_current_month}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
div do
|
||||
'DESIRED PLAN CODE = What plan the user has selected in the UI'
|
||||
end
|
||||
div do
|
||||
'SUBSCRIPTION PLAN CODE = What plan the user actually has'
|
||||
end
|
||||
div do
|
||||
div do
|
||||
user.recurly_code ? link_to('Recurly Account', user.recurly_link_to_account, target: "_blank", ) : span do 'No Recurly Account' end
|
||||
end
|
||||
div do
|
||||
user.recurly_subscription_id ? link_to('Recurly Subscription', user.recurly_link_to_subscription, target: "_blank", ) : span do 'No Recurly Subscription' end
|
||||
end
|
||||
end
|
||||
div do
|
||||
h3 do
|
||||
'Give Free Plan Actions'
|
||||
end
|
||||
h4 do
|
||||
'sets secret override to give user a free plan (link goes to another page)'
|
||||
end
|
||||
div do
|
||||
link_to("give no-payment plan", edit_admin_user_override_path(user.id))
|
||||
end
|
||||
end
|
||||
div do
|
||||
h3 do
|
||||
'Reset Monthly Play Time'
|
||||
end
|
||||
h4 do
|
||||
'sets the user\'s monthly play time to 0'
|
||||
end
|
||||
div do
|
||||
link_to("reset monthly play time", reset_monthly_play_admin_user_path(user.id), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
end
|
||||
div do
|
||||
h3 do
|
||||
'Change Plan Actions'
|
||||
end
|
||||
h4 do
|
||||
'Change desired plan exactly as if the user did it on /client#/accounts/subscription'
|
||||
end
|
||||
div do
|
||||
link_to("change plan to silver monthly", change_to_plan_admin_user_path(user.id, plan_code: 'jamsubsilver'), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
div do
|
||||
link_to("change plan to gold monthly", change_to_plan_admin_user_path(user.id, plan_code: 'jamsubgold'), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
div do
|
||||
link_to("change plan to platinum monthly", change_to_plan_admin_user_path(user.id, plan_code: 'jamsubplatinum'), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
div do
|
||||
link_to("change plan to silver yearly", change_to_plan_admin_user_path(user.id, plan_code: 'jamsubsilveryearly'), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
div do
|
||||
link_to("change plan to gold yearly", change_to_plan_admin_user_path(user.id, plan_code: 'jamsubgoldyearly'), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
div do
|
||||
link_to("change plan to platinum yearly", change_to_plan_admin_user_path(user.id, plan_code: 'jamsubplatinumyearly'), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
div do
|
||||
link_to("change plan to free", change_to_plan_admin_user_path(user.id, plan_code: ''), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
|
||||
end
|
||||
div do
|
||||
h3 do
|
||||
'Force Sync'
|
||||
end
|
||||
h4 do
|
||||
'exactly same as background job that checks accounts'
|
||||
end
|
||||
div do
|
||||
link_to("force sync", sync_subscription_admin_user_path(user.id), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
end
|
||||
|
||||
div do
|
||||
h3 do
|
||||
'End Trial'
|
||||
end
|
||||
h4 do
|
||||
'ends the trial as of 3 days ago'
|
||||
end
|
||||
div do
|
||||
link_to("end trial", end_trial_admin_user_path(user.id), :data => {:confirm => 'Are you sure?'})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
row :jamclass_credits
|
||||
row :via_amazon
|
||||
row "Web Profile" do
|
||||
link_to "Link", "#{Rails.application.config.external_root_url}/client#/profile/#{user.id}"
|
||||
end
|
||||
row :image do
|
||||
user.photo_url ? image_tag(user.photo_url) : ''
|
||||
end
|
||||
row "Instruments" do
|
||||
table_for user.musician_instruments.order('proficiency_level desc') do
|
||||
column :instrument_id
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
attributes_table do
|
||||
row :id
|
||||
row :email
|
||||
row :admin
|
||||
row :updated_at
|
||||
row :created_at
|
||||
row :musician
|
||||
row :city
|
||||
row :state
|
||||
row :country
|
||||
row :first_name
|
||||
row :last_name
|
||||
row :birth_date
|
||||
row :gender
|
||||
row :email_confirmed
|
||||
row :remember_token
|
||||
row :image do user.photo_url ? image_tag(user.photo_url) : '' end
|
||||
end
|
||||
|
||||
panel "School" do
|
||||
div do
|
||||
attributes_table do
|
||||
row "School" do |user|
|
||||
span do
|
||||
if user.school
|
||||
link_to user.school.name, admin_school_path(user.school), target: '_blank'
|
||||
end
|
||||
end
|
||||
end
|
||||
if user.school
|
||||
row :license_start
|
||||
row :license_end
|
||||
row :is_platform_instructor
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# panel "Onboarding" do
|
||||
# attributes_table do
|
||||
# row :onboarding_status
|
||||
# row "Support Consultant" do |user|
|
||||
# if user.onboarder
|
||||
# link_to "#{user.onboarder.name} (#{user.onboarder.onboarding_users.count})", user.onboarder.admin_url
|
||||
# else
|
||||
# end
|
||||
# end
|
||||
# row "Signup" do
|
||||
# user.created_at.to_date
|
||||
# end
|
||||
# row "Assigned", :onboarder_assigned_at
|
||||
# row "Email 1", :onboarding_email_1_sent_at
|
||||
# row "Email 2", :onboarding_email_2_sent_at
|
||||
# row "Email 3", :onboarding_email_3_sent_at
|
||||
# row "Email 4", :onboarding_email_4_sent_at
|
||||
# row "Email 5", :onboarding_email_5_sent_at
|
||||
# row "Test Session Scheduled Time", :onboarding_test_session_at
|
||||
# row "When Test Session Was Requested", :onboarding_test_session_at
|
||||
# row "Test Session Outcome", :onboarding_test_session_outcome
|
||||
# row "Notes", :onboarding_onboarder_notes
|
||||
# row "Lost Reason", :onboarding_lost_reason
|
||||
# row "Lost At", :onboarding_lost_at
|
||||
# row "Escalated Reason", :onboarding_escalation_reason
|
||||
# row "Escalated At", :onboarding_escalated_at
|
||||
|
||||
# end
|
||||
# end
|
||||
=begin
|
||||
|
||||
panel "Teacher Setting" do
|
||||
attributes_table do
|
||||
row :is_searchable
|
||||
end
|
||||
end if user.teacher
|
||||
|
||||
|
||||
panel "Lessons" do
|
||||
attributes_table do
|
||||
row "Taken Lessons" do
|
||||
table_for user.taken_lessons.order('created_at desc') do
|
||||
column "View" do |lesson_session|
|
||||
link_to("View", lesson_session.admin_url)
|
||||
end
|
||||
column :created_at
|
||||
column :status
|
||||
column "Teacher" do |lesson_session|
|
||||
teacher = lesson_session.teacher
|
||||
span do
|
||||
link_to teacher.admin_name, teacher.admin_url
|
||||
end
|
||||
end
|
||||
column "Start Time" do |lesson_session|
|
||||
span do
|
||||
lesson_session.music_session.pretty_scheduled_start(true)
|
||||
end
|
||||
br
|
||||
span do
|
||||
lesson_session.music_session.scheduled_start
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
row "Taught Lessons" do
|
||||
table_for user.taught_lessons.order('created_at desc') do
|
||||
column "View" do |lesson_session|
|
||||
link_to("View", lesson_session.admin_url)
|
||||
end
|
||||
column :created_at
|
||||
column :status
|
||||
column "Student" do |lesson_session|
|
||||
student = lesson_session.student
|
||||
span do
|
||||
link_to student.admin_name, student.admin_name
|
||||
end
|
||||
end
|
||||
column "Start Time" do |lesson_session|
|
||||
span do
|
||||
lesson_session.music_session.pretty_scheduled_start(true)
|
||||
end
|
||||
br
|
||||
span do
|
||||
lesson_session.music_session.scheduled_start
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
=end
|
||||
|
||||
panel "JamTracks" do
|
||||
div do
|
||||
link_to "Give JamTrack", "../jam_track_rights/new"
|
||||
end
|
||||
|
||||
attributes_table do
|
||||
row "Purchased JamTracks" do
|
||||
table_for user.purchased_jam_tracks.unscope(:order).order('original_artist asc', 'name asc') do
|
||||
column "Artist", :original_artist
|
||||
column "Name", :name
|
||||
column "Can Download", :can_download
|
||||
column "Version", :version
|
||||
column "ID", :id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
active_admin_comments
|
||||
end
|
||||
|
||||
index do
|
||||
# actions # use this for all view/edit/delete links
|
||||
column "ID" do |user|
|
||||
link_to(truncate(user.id, {:length => 12}),
|
||||
resource_path(user),
|
||||
{:title => user.id})
|
||||
end
|
||||
column "Email" do |user|
|
||||
link_to user.email, resource_path(user)
|
||||
end
|
||||
column :admin
|
||||
column :updated_at
|
||||
column :created_at
|
||||
column :musician do |user| user.musician? ? true : false end
|
||||
column :city
|
||||
column :state
|
||||
column :country
|
||||
column :first_name
|
||||
column :last_name
|
||||
column :birth_date
|
||||
column :gender
|
||||
column :email_confirmed
|
||||
column :photo_url
|
||||
column :session_settings
|
||||
column :can_invite
|
||||
|
||||
# default_actions # use this for all view/edit/delete links
|
||||
column "Actions" do |user|
|
||||
links = ''.html_safe
|
||||
links << link_to("View", resource_path(user), :class => "member_link view_link")
|
||||
links << link_to("Edit", edit_resource_path(user), :class => "member_link edit_link")
|
||||
links
|
||||
end
|
||||
|
||||
column "Email" do |user|
|
||||
link_to user.email, resource_path(user)
|
||||
end
|
||||
column :subscription_plan_code
|
||||
column :desired_plan_code
|
||||
column :created_at
|
||||
column :first_name
|
||||
column :last_name
|
||||
column :city
|
||||
column :state
|
||||
end
|
||||
|
||||
|
||||
controller do
|
||||
|
||||
# this actually searches on first name, last name, and email, because of get_autocomplete_items defined below
|
||||
autocomplete :user, :email, :full => true, :display_value => :autocomplete_display_name, extra_data: [:last_jam_addr]
|
||||
autocomplete :user, :email, :full => true, :display_value => :autocomplete_display_name
|
||||
|
||||
def get_autocomplete_items(parameters)
|
||||
term = parameters[:term]
|
||||
if term.include?('@')
|
||||
User.select("email, first_name, last_name, id, last_jam_addr").where(["email = ?", term]).limit(5)
|
||||
else
|
||||
User.select("email, first_name, last_name, id, last_jam_addr").where(["email ILIKE ? OR first_name ILIKE ? OR last_name ILIKE ?", "%#{term}%", "%#{term}%", "%#{term}%"]).limit(40)
|
||||
end
|
||||
User.select("email, first_name, last_name, id").where(["email ILIKE ? OR first_name ILIKE ? OR last_name ILIKE ?", "%#{parameters[:term]}%", "%#{parameters[:term]}%", "%#{parameters[:term]}%"])
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -667,14 +100,11 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
|||
@user = resource
|
||||
@user.email = params[:jam_ruby_user][:email]
|
||||
@user.admin = params[:jam_ruby_user][:admin]
|
||||
@user.subscribe_email = params[:jam_ruby_user][:subscribe_email]
|
||||
@user.musician = params[:jam_ruby_user][:musician]
|
||||
@user.musician = params[:jam_ruby_user][:musician]
|
||||
@user.first_name = params[:jam_ruby_user][:first_name]
|
||||
@user.last_name = params[:jam_ruby_user][:last_name]
|
||||
@user.state = params[:jam_ruby_user][:state]
|
||||
@user.city = params[:jam_ruby_user][:city]
|
||||
@user.is_platform_instructor = params[:jam_ruby_user][:is_platform_instructor]
|
||||
@user.gifted_jamtracks = params[:jam_ruby_user][:gifted_jamtracks]
|
||||
|
||||
|
||||
if params[:jam_ruby_user][:show_frame_options].to_i == 1
|
||||
|
|
@ -692,7 +122,7 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
|||
|
||||
|
||||
if params[:jam_ruby_user][:configure_video_no_show].to_i == 1
|
||||
@user.mod_merge({User::MOD_NO_SHOW => {User::CONFIGURE_VIDEO_NOSHOW => true}})
|
||||
@user.mod_merge({User::MOD_NO_SHOW => {User::CONFIGURE_VIDEO_NOSHOW=> true}})
|
||||
else
|
||||
@user.delete_mod(User::MOD_NO_SHOW, User::CONFIGURE_VIDEO_NOSHOW)
|
||||
end
|
||||
|
|
@ -703,97 +133,6 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
|||
redirect_to edit_admin_user_path(@user)
|
||||
|
||||
end
|
||||
|
||||
def user_latency_recommendation
|
||||
recommendation_params = params[:latency_recommendation]
|
||||
|
||||
offset = recommendation_params[:offset].blank?? 0 : recommendation_params[:offset]
|
||||
limit = recommendation_params[:limit].blank?? 20 : recommendation_params[:limit]
|
||||
|
||||
is_valid = [
|
||||
recommendation_params[:my_user_id],
|
||||
recommendation_params[:my_public_ip]
|
||||
].all?{ |param|
|
||||
param.present?
|
||||
}
|
||||
|
||||
if is_valid
|
||||
instruments = []
|
||||
instruments << recommendation_params[:instruments_beginner].reject(&:blank?).map{|i| { id: i, proficiency: 1} }
|
||||
instruments << recommendation_params[:instruments_advanced].reject(&:blank?).map{|i| { id: i, proficiency: 2} }
|
||||
instruments << recommendation_params[:instruments_expert].reject(&:blank?).map{|i| { id: i, proficiency: 3} }
|
||||
instruments.flatten!
|
||||
genres = recommendation_params[:genres].reject(&:blank?)
|
||||
wifi = recommendation_params[:wifi]
|
||||
max_latency = recommendation_params[:max_latency]
|
||||
|
||||
data = {
|
||||
my_user_id: recommendation_params[:my_user_id],
|
||||
my_public_ip: recommendation_params[:my_public_ip],
|
||||
offset: offset,
|
||||
limit: limit
|
||||
}
|
||||
|
||||
data.merge!({query: recommendation_params[:query]}) unless recommendation_params[:query].blank?
|
||||
data.merge!({instruments: instruments}) unless instruments.empty?
|
||||
data.merge!({genres: genres}) unless genres.empty?
|
||||
data.merge!({wifi: wifi}) if %w(true false).include?(wifi)
|
||||
data.merge!({max_latency: max_latency}) unless max_latency.blank?
|
||||
|
||||
latency_url = "#{Rails.application.config.latency_data_host}/recommendations"
|
||||
uri = URI(latency_url)
|
||||
|
||||
begin
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.read_timeout = 5
|
||||
http.use_ssl = true if Rails.application.config.latency_data_host.start_with?("https://")
|
||||
request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
|
||||
request.body = data.to_json
|
||||
request["Authorization"] = "Basic #{Rails.application.config.latency_data_host_auth_code}"
|
||||
response = http.request(request)
|
||||
@latency_recommendation = response.body
|
||||
rescue => exception
|
||||
render text: exception.message
|
||||
end
|
||||
|
||||
else
|
||||
flash[:error] = 'Please provide all required fields'
|
||||
redirect_to admin_latency_recommendation_path
|
||||
end
|
||||
end
|
||||
|
||||
def user_latencies
|
||||
latency_params = params[:latencies]
|
||||
latency_url = "#{Rails.application.config.latency_data_host}/user_latencies"
|
||||
uri = URI(latency_url)
|
||||
if not ([latency_params[:my_user_id], latency_params[:my_public_ip], latency_params[:user_1_id]]).any?{|param| param.blank? }
|
||||
user_ids = [latency_params[:user_1_id]]
|
||||
user_ids.push(latency_params[:user_2_id]) unless latency_params[:user_2_id].blank?
|
||||
user_ids.push(latency_params[:user_3_id]) unless latency_params[:user_3_id].blank?
|
||||
user_ids.push(latency_params[:user_4_id]) unless latency_params[:user_4_id].blank?
|
||||
user_ids.push(latency_params[:user_5_id]) unless latency_params[:user_5_id].blank?
|
||||
begin
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.read_timeout = 5
|
||||
http.use_ssl = true if Rails.application.config.latency_data_host.start_with?("https://")
|
||||
request = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')
|
||||
request.body = {
|
||||
my_user_id: latency_params[:my_user_id],
|
||||
my_public_ip: latency_params[:my_public_ip],
|
||||
users: user_ids
|
||||
}.to_json
|
||||
request["Authorization"] = "Basic #{Rails.application.config.latency_data_host_auth_code}"
|
||||
response = http.request(request)
|
||||
@user_latencies = response.body
|
||||
#render text: JSON.pretty_generate(@user_latencies)
|
||||
rescue => e
|
||||
render text: e.message
|
||||
end
|
||||
else
|
||||
flash[:error] = 'Please provide all required fields'
|
||||
redirect_to admin_latency_between_users_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ ActiveAdmin.register_page "Harry Fox Request" do
|
|||
|
||||
|
||||
content do
|
||||
active_admin_form_for JamTrackHfaRequest.new, :url => admin_harry_fox_request_create_request_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
semantic_form_for JamTrackHfaRequest.new, :url => admin_harry_fox_request_create_request_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
f.inputs "New Harry Fox Licensing Request" do
|
||||
f.input :name, :hint => "Some sort of name to help us remember what this request was for"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -17,16 +17,8 @@ ActiveAdmin.register JamRuby::JamTrackRight, :as => 'JamTrackRights' do
|
|||
|
||||
filter :jam_track
|
||||
|
||||
controller do
|
||||
def create
|
||||
jt_params = params[:jam_ruby_jam_track_right]
|
||||
jt_params[:jam_track] =JamRuby::JamTrack.where("id=?", jt_params[:jam_track_id_val]).first # jt_params[:jam_track_id_val]
|
||||
jt_params[:user] = JamRuby::User.where("id=?", jt_params[:user_id_val]).first # jt_params[:user_id_val]
|
||||
create!
|
||||
end
|
||||
end
|
||||
index do
|
||||
actions
|
||||
default_actions
|
||||
|
||||
#column "Order" do |right|
|
||||
#link_to("Place", order_admin_jam_track_right_path(right)) + " | " +
|
||||
|
|
@ -55,14 +47,8 @@ ActiveAdmin.register JamRuby::JamTrackRight, :as => 'JamTrackRights' do
|
|||
|
||||
form do |f|
|
||||
f.inputs 'New Jam Track Right' do
|
||||
#f.input :jam_track, :required=>true, collection: JamTrack.all, include_blank: false
|
||||
f.input :jam_track_id_val, :required=>true, :as => :hidden
|
||||
|
||||
f.input :jam_track, :required=>true, :as => :autocomplete, :url => autocomplete_jam_track_name_admin_jam_tracks_path, hint: 'Select a jamtrack to give to this user'
|
||||
#f.input :user, :required=>true, collection: User.all, include_blank: false
|
||||
f.input :user_id_val, :required=>true, :as => :hidden
|
||||
f.input :user, :required=>true, :as => :autocomplete, :url => autocomplete_user_email_admin_users_path, hint: 'Give a free jamtrack to this user'
|
||||
f.input :can_download, :required => true, as: :boolean, :input_html => { :checked => 'checked' }
|
||||
f.input :jam_track, :required=>true, collection: JamTrack.all, include_blank: false
|
||||
f.input :user, :required=>true, collection: User.all, include_blank: false
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
|
||||
|
||||
collection_action :autocomplete_jam_track_name, :method => :get
|
||||
|
||||
menu :label => 'JamTracks', :parent => 'JamTracks'
|
||||
|
||||
config.sort_order = 'name_asc'
|
||||
|
|
@ -21,22 +19,9 @@ ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
|
|||
|
||||
form :partial => 'form'
|
||||
|
||||
|
||||
controller do
|
||||
|
||||
# this actually searches on first name, last name, and email, because of get_autocomplete_items defined below
|
||||
autocomplete :jam_track, :name, :full => true, :display_value => :autocomplete_display_name
|
||||
|
||||
def get_autocomplete_items(parameters)
|
||||
JamTrack.select("name, original_artist, id").where(["name ILIKE ? OR original_artist ILIKE ?", "%#{parameters[:term]}%", "%#{parameters[:term]}%"])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
index do
|
||||
|
||||
# actions # use this for all view/edit/delete links
|
||||
# default_actions # use this for all view/edit/delete links
|
||||
column "Actions" do |jam_track|
|
||||
links = ''.html_safe
|
||||
clz = "member_link view_link show_tracks"
|
||||
|
|
@ -50,7 +35,7 @@ ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
|
|||
column :name
|
||||
column :onboarding_exceptions do |jam_track|
|
||||
if jam_track.onboarding_exceptions
|
||||
exceptions = jam_track.onboarding_exceptions
|
||||
exceptions = JSON.parse(jam_track.onboarding_exceptions)
|
||||
exceptions.keys.join(',')
|
||||
else
|
||||
''
|
||||
|
|
@ -70,7 +55,6 @@ ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
|
|||
column :licensor_royalty_amount
|
||||
column :id
|
||||
|
||||
=begin
|
||||
column :jam_track_tracks do |jam_track|
|
||||
table_for jam_track.jam_track_tracks.order('position ASC') do
|
||||
column :id
|
||||
|
|
@ -93,8 +77,6 @@ ActiveAdmin.register JamRuby::JamTrack, :as => 'JamTracks' do
|
|||
end
|
||||
end
|
||||
end
|
||||
=end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
ActiveAdmin.register JamRuby::Jamblaster, :as => 'Jamblaster' do
|
||||
ActiveAdmin.register JamRuby::Jamblaster, :as => 'Jamblaster' do
|
||||
|
||||
|
||||
config.filters = false
|
||||
menu :label => 'JamBlasters', :parent => 'JamBlaster'
|
||||
|
||||
scope("Connected", default: true) { |scope| scope.where('client_id in (select client_id from connections)') }
|
||||
scope("All") { |scope| scope.order('created_at desc') }
|
||||
|
||||
form do |f|
|
||||
f.inputs 'New JamBlaster' do
|
||||
f.input :user, required: true, collection: User.all, include_blank: false
|
||||
|
|
@ -16,25 +12,4 @@ ActiveAdmin.register JamRuby::Jamblaster, :as => 'Jamblaster' do
|
|||
end
|
||||
f.actions
|
||||
end
|
||||
|
||||
|
||||
index do
|
||||
|
||||
# actions # use this for all view/edit/delete links
|
||||
|
||||
column 'Serial' do |oo|
|
||||
oo.serial_no
|
||||
end
|
||||
|
||||
column 'IPv4' do |oo|
|
||||
oo.ipv4_link_local
|
||||
end
|
||||
|
||||
column 'IPv6' do |oo|
|
||||
oo.ipv6_link_local
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,185 +0,0 @@
|
|||
class Spacer
|
||||
def self.spacer(val, row)
|
||||
|
||||
percentage = ((val * 100) / row.total.to_f).round(1).to_s
|
||||
('%-5.5s' % percentage).gsub(' ', ' ') + '% - ' + val.to_s
|
||||
end
|
||||
end
|
||||
=begin
|
||||
select
|
||||
count(id) as total,
|
||||
count(first_downloaded_client_at) as downloaded,
|
||||
count(first_ran_client_at) as ran_client,
|
||||
count(first_certified_gear_at) as ftue,
|
||||
count(first_music_session_at) as any_session,
|
||||
count(first_real_music_session_at) as real_session,
|
||||
count(first_good_music_session_at) as good_session,
|
||||
count(first_invited_at) as invited,
|
||||
count(first_friended_at) as friended,
|
||||
count(first_subscribed_at) as subscribed
|
||||
from users where users.created_at >= '2024-11-01' AND users.created_at < '2025-04-01'
|
||||
|
||||
select first_name, last_name, email
|
||||
from users where users.created_at >= '2024-11-01' AND users.created_at < '2025-04-01'
|
||||
AND first_music_session_at is NULL;
|
||||
|
||||
=end
|
||||
|
||||
ActiveAdmin.register_page "Jammers Subscription Cohorts" do
|
||||
menu :parent => 'Reports'
|
||||
|
||||
content :title => "Jammers Subscription Cohorts" do
|
||||
|
||||
filter_type = params[:filter_type] || 'All'
|
||||
filter_campaign = params[:filter_campaign]
|
||||
filter_campaign_id = params[:filter_campaign_id]
|
||||
filter_ad_set = params[:filter_ad_set]
|
||||
filter_ad_name = params[:filter_ad_name]
|
||||
|
||||
campaigns = User.where("origin_utm_medium = 'cpc'").distinct.pluck(:origin_utm_campaign).compact.sort
|
||||
campaign_ids = User.where("origin_utm_medium = 'cpc'").distinct.pluck(:origin_id).compact.sort
|
||||
ad_sets = User.where("origin_utm_medium = 'cpc'").distinct.pluck(:origin_term).compact.sort
|
||||
ad_names = User.where("origin_utm_medium = 'cpc'").distinct.pluck(:origin_content).compact.sort
|
||||
|
||||
div style: "margin-bottom: 20px; padding: 10px; background-color: #f4f4f4; border-radius: 4px;" do
|
||||
form action: admin_jammers_subscription_cohorts_path, method: :get do
|
||||
span "Source: ", style: "font-weight: bold; margin-right: 5px;"
|
||||
select name: 'filter_type', onchange: 'this.form.submit()', style: "margin-right: 15px;" do
|
||||
option "All", value: 'All', selected: filter_type == 'All'
|
||||
option "Organic", value: 'Organic', selected: filter_type == 'Organic'
|
||||
option "Advertising", value: 'Advertising', selected: filter_type == 'Advertising'
|
||||
end
|
||||
|
||||
if filter_type == 'Advertising'
|
||||
div style: "margin-top: 10px;" do
|
||||
span "Campaign Name: ", style: "font-weight: bold; margin-right: 5px;"
|
||||
select name: 'filter_campaign', onchange: 'this.form.submit()', style: "margin-right: 15px;" do
|
||||
option "All", value: ''
|
||||
option "Null", value: 'NULL', selected: filter_campaign == 'NULL'
|
||||
campaigns.each do |c|
|
||||
option c, value: c, selected: filter_campaign == c
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
div style: "margin-top: 10px;" do
|
||||
span "Campaign ID: ", style: "font-weight: bold; margin-right: 5px;"
|
||||
select name: 'filter_campaign_id', onchange: 'this.form.submit()', style: "margin-right: 15px;" do
|
||||
option "All", value: ''
|
||||
option "Null", value: 'NULL', selected: filter_campaign_id == 'NULL'
|
||||
campaign_ids.each do |c|
|
||||
option c, value: c, selected: filter_campaign_id == c
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
div style: "margin-top: 10px;" do
|
||||
span "Ad Set: ", style: "font-weight: bold; margin-right: 5px;"
|
||||
select name: 'filter_ad_set', onchange: 'this.form.submit()', style: "margin-right: 15px;" do
|
||||
option "All", value: ''
|
||||
option "Null", value: 'NULL', selected: filter_ad_set == 'NULL'
|
||||
ad_sets.each do |c|
|
||||
option c, value: c, selected: filter_ad_set == c
|
||||
end
|
||||
end
|
||||
|
||||
div style: "margin-top: 10px;" do
|
||||
span "Ad Name: ", style: "font-weight: bold; margin-right: 5px;"
|
||||
select name: 'filter_ad_name', onchange: 'this.form.submit()', style: "margin-right: 15px;" do
|
||||
option "All", value: ''
|
||||
option "Null", value: 'NULL', selected: filter_ad_name == 'NULL'
|
||||
ad_names.each do |c|
|
||||
option c, value: c, selected: filter_ad_name == c
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
noscript { input type: :submit, value: "Filter" }
|
||||
end
|
||||
end
|
||||
|
||||
h2 "Users Grouped By Month as Paying Subscribers"
|
||||
|
||||
query = User.select(%Q{date_trunc('month', users.created_at) as month,
|
||||
count(id) as total,
|
||||
count(first_downloaded_client_at) as downloaded,
|
||||
count(first_ran_client_at) as ran_client,
|
||||
count(first_certified_gear_at) as ftue,
|
||||
count(first_music_session_at) as any_session,
|
||||
count(first_real_music_session_at) as real_session,
|
||||
count(first_good_music_session_at) as good_session,
|
||||
count(first_invited_at) as invited,
|
||||
count(first_friended_at) as friended,
|
||||
count(first_subscribed_at) as subscribed,
|
||||
count(first_played_jamtrack_at) as played_jamtrack
|
||||
})
|
||||
.joins(%Q{LEFT JOIN LATERAL (
|
||||
SELECT
|
||||
j.created_at
|
||||
FROM
|
||||
jam_track_rights as j
|
||||
WHERE
|
||||
j.user_id = users.id
|
||||
ORDER BY
|
||||
j.created_at
|
||||
LIMIT 1 -- Select only that single row
|
||||
) j ON TRUE })
|
||||
|
||||
if filter_type == 'Organic'
|
||||
query = query.where("users.origin_utm_source = 'organic'")
|
||||
elsif filter_type == 'Advertising'
|
||||
query = query.where("origin_utm_medium = 'cpc'")
|
||||
|
||||
if filter_campaign.present?
|
||||
if filter_campaign == 'NULL'
|
||||
query = query.where("users.origin_utm_campaign IS NULL")
|
||||
elsif filter_campaign != 'All'
|
||||
query = query.where("users.origin_utm_campaign = ?", filter_campaign)
|
||||
end
|
||||
end
|
||||
|
||||
if filter_campaign_id.present?
|
||||
if filter_campaign_id == 'NULL'
|
||||
query = query.where("users.origin_id IS NULL")
|
||||
elsif filter_campaign_id != 'All'
|
||||
query = query.where("users.origin_id = ?", filter_campaign_id)
|
||||
end
|
||||
end
|
||||
|
||||
if filter_ad_set.present?
|
||||
if filter_ad_set == 'NULL'
|
||||
query = query.where("users.origin_term IS NULL")
|
||||
elsif filter_ad_set != 'All'
|
||||
query = query.where("users.origin_term = ?", filter_ad_set)
|
||||
end
|
||||
end
|
||||
|
||||
if filter_ad_name.present?
|
||||
if filter_ad_name == 'NULL'
|
||||
query = query.where("users.origin_content IS NULL")
|
||||
elsif filter_ad_name != 'All'
|
||||
query = query.where("users.origin_content = ?", filter_ad_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table_for query.group("date_trunc('month', users.created_at)")
|
||||
.where("j.created_at IS NULL OR (j.created_at - users.created_at) >= INTERVAL '2 hours'")
|
||||
.order("date_trunc('month', users.created_at) DESC") do |row|
|
||||
column "Month", Proc.new { |user| user.month.strftime('%B %Y') }
|
||||
column "Total", :total
|
||||
column "Subscribed", Proc.new { |user| raw(Spacer.spacer(user.subscribed, user)) }
|
||||
column "Downloaded", Proc.new { |user| raw(Spacer.spacer(user.downloaded, user)) }
|
||||
column "Ran Client", Proc.new { |user| raw(Spacer.spacer(user.ran_client, user)) }
|
||||
column "FTUE", Proc.new { |user| raw(Spacer.spacer(user.ftue, user)) }
|
||||
column "Any Session", Proc.new { |user| raw(Spacer.spacer(user.any_session, user)) }
|
||||
column "2+ Session", Proc.new { |user| raw(Spacer.spacer(user.real_session, user)) }
|
||||
column "Good Session", Proc.new { |user| raw(Spacer.spacer(user.good_session, user)) }
|
||||
column "Invited", Proc.new { |user| raw(Spacer.spacer(user.invited, user)) }
|
||||
column "Friended", Proc.new { |user| raw(Spacer.spacer(user.friended, user)) }
|
||||
column "Played JT", Proc.new { |user| raw(Spacer.spacer(user.played_jamtrack, user)) }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
class Spacer
|
||||
def self.spacer(val, row)
|
||||
|
||||
percentage = ((val * 100) / row.total.to_f).round(1).to_s
|
||||
('%-5.5s' % percentage).gsub(' ', ' ') + '% - ' + val.to_s
|
||||
end
|
||||
end
|
||||
=begin
|
||||
select
|
||||
count(id) as total,
|
||||
count(first_downloaded_client_at) as downloaded,
|
||||
count(first_ran_client_at) as ran_client,
|
||||
count(first_certified_gear_at) as ftue,
|
||||
count(first_music_session_at) as any_session,
|
||||
count(first_real_music_session_at) as real_session,
|
||||
count(first_good_music_session_at) as good_session,
|
||||
count(first_invited_at) as invited,
|
||||
count(first_friended_at) as friended,
|
||||
count(first_subscribed_at) as subscribed
|
||||
from users where users.created_at >= '2024-11-01' AND users.created_at < '2025-04-01'
|
||||
|
||||
select first_name, last_name, email
|
||||
from users where users.created_at >= '2024-11-01' AND users.created_at < '2025-04-01'
|
||||
AND first_music_session_at is NULL;
|
||||
|
||||
=end
|
||||
|
||||
ActiveAdmin.register_page "JamTrack Subscription Cohorts" do
|
||||
menu :parent => 'Reports'
|
||||
|
||||
content :title => "JamTrack Subscription Cohorts" do
|
||||
h2 "Users Grouped By Month as Paying Subscribers"
|
||||
table_for User.select(%Q{date_trunc('month', users.created_at) as month,
|
||||
count(id) as total,
|
||||
count(first_downloaded_client_at) as downloaded,
|
||||
count(first_ran_client_at) as ran_client,
|
||||
count(first_certified_gear_at) as ftue,
|
||||
count(first_music_session_at) as any_session,
|
||||
count(first_real_music_session_at) as real_session,
|
||||
count(first_good_music_session_at) as good_session,
|
||||
count(first_invited_at) as invited,
|
||||
count(first_friended_at) as friended,
|
||||
count(first_subscribed_at) as subscribed,
|
||||
count(first_played_jamtrack_at) as played_jamtrack
|
||||
})
|
||||
.joins(%Q{INNER JOIN LATERAL (
|
||||
SELECT
|
||||
j.created_at
|
||||
FROM
|
||||
jam_track_rights as j
|
||||
WHERE
|
||||
j.user_id = users.id
|
||||
ORDER BY
|
||||
j.created_at
|
||||
LIMIT 1 -- Select only that single row
|
||||
) j ON (j.created_at - users.created_at) < INTERVAL '2 hours' })
|
||||
.group("date_trunc('month', users.created_at)").order("date_trunc('month', users.created_at) DESC") do |row|
|
||||
column "Month", Proc.new { |user| user.month.strftime('%B %Y') }
|
||||
column "Total", :total
|
||||
column "Subscribed", Proc.new { |user| raw(Spacer.spacer(user.subscribed, user)) }
|
||||
column "Downloaded", Proc.new { |user| raw(Spacer.spacer(user.downloaded, user)) }
|
||||
column "Ran Client", Proc.new { |user| raw(Spacer.spacer(user.ran_client, user)) }
|
||||
column "FTUE", Proc.new { |user| raw(Spacer.spacer(user.ftue, user)) }
|
||||
column "Any Session", Proc.new { |user| raw(Spacer.spacer(user.any_session, user)) }
|
||||
column "2+ Session", Proc.new { |user| raw(Spacer.spacer(user.real_session, user)) }
|
||||
column "Good Session", Proc.new { |user| raw(Spacer.spacer(user.good_session, user)) }
|
||||
column "Invited", Proc.new { |user| raw(Spacer.spacer(user.invited, user)) }
|
||||
column "Friended", Proc.new { |user| raw(Spacer.spacer(user.friended, user)) }
|
||||
column "Played JT", Proc.new { |user| raw(Spacer.spacer(user.played_jamtrack, user)) }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
ActiveAdmin.register JamRuby::LessonBooking, :as => 'LessonBookings' do
|
||||
|
||||
menu :label => 'Lesson Booking', :parent => 'JamClass'
|
||||
menu :label => 'LessonBooking', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
|
|
@ -8,16 +8,16 @@ ActiveAdmin.register JamRuby::LessonBooking, :as => 'LessonBookings' do
|
|||
config.paginate = true
|
||||
config.filters = false
|
||||
|
||||
scope("All", default: true) { |scope| scope.unscoped.order('created_at desc') }
|
||||
scope("All", default: true ) { |scope| scope.unscoped.order('created_at desc') }
|
||||
scope("Requested") { |scope| scope.unscoped.where(status: LessonBooking::STATUS_REQUESTED).order('created_at desc') }
|
||||
scope("Approved") { |scope| scope.unscoped.approved.order('created_at desc') }
|
||||
scope("Suspended") { |scope| scope.unscoped.suspended.order('created_at desc') }
|
||||
scope("Canceled") { |scope| scope.unscoped.canceled.order('created_at desc') }
|
||||
scope("Suspended" ) { |scope| scope.unscoped.suspended.order('created_at desc') }
|
||||
scope("Canceled" ) { |scope| scope.unscoped.canceled.order('created_at desc') }
|
||||
|
||||
index do
|
||||
column "User Link" do |lesson_booking|
|
||||
span do
|
||||
link_to "Lesson Session URL", "#{lesson_booking.next_lesson.admin_url}"
|
||||
link_to "Web URL", "#{Rails.application.config.external_root_url}/client#/jamclass/lesson-booking/#{lesson_booking.id}"
|
||||
end
|
||||
end
|
||||
column "Type" do |lesson_booking|
|
||||
|
|
@ -41,37 +41,6 @@ ActiveAdmin.register JamRuby::LessonBooking, :as => 'LessonBookings' do
|
|||
end
|
||||
|
||||
show do
|
||||
attributes_table do
|
||||
row "User Link" do |lesson_booking|
|
||||
span do
|
||||
link_to "Web URL", "#{Rails.application.config.external_root_url}/client#/jamclass/lesson-booking/#{lesson_booking.id}"
|
||||
end
|
||||
end
|
||||
row "Type" do |lesson_booking|
|
||||
lesson_booking.display_type
|
||||
end
|
||||
row "Status" do |lesson_booking|
|
||||
lesson_booking.status
|
||||
end
|
||||
row "Teacher" do |lesson_booking|
|
||||
teacher = lesson_booking.teacher
|
||||
span do
|
||||
link_to "#{teacher.name} (#{teacher.email})", "#{Rails.application.config.external_root_url}/client#/profile/teacher/#{teacher.id}"
|
||||
end
|
||||
end
|
||||
row "Student" do |lesson_booking|
|
||||
student = lesson_booking.student
|
||||
span do
|
||||
link_to "#{student.name} (#{student.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{student.id}"
|
||||
end
|
||||
end
|
||||
row "Created At" do |lesson_booking|
|
||||
lesson_booking.created_at
|
||||
end
|
||||
row "Booked Price" do |lesson_booking|
|
||||
lesson_booking.booked_price
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,68 +1,34 @@
|
|||
ActiveAdmin.register JamRuby::LessonSession, :as => 'LessonSessions' do
|
||||
|
||||
menu :label => 'Lesson Session', :parent => 'JamClass'
|
||||
menu :label => 'LessonSession', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = true
|
||||
config.filters = false
|
||||
|
||||
scope("All", default: true) { |scope| scope.order('created_at desc') }
|
||||
scope("Requested") { |scope| scope.where(status: LessonBooking::STATUS_REQUESTED).order('created_at desc') }
|
||||
scope("Approved") { |scope| scope.approved.order('created_at desc') }
|
||||
scope("Suspended") { |scope| scope.suspended.order('created_at desc') }
|
||||
scope("Canceled") { |scope| scope.canceled.order('created_at desc') }
|
||||
scope("Missed") { |scope| scope.missed.order('created_at desc') }
|
||||
scope("Completed") { |scope| scope.completed.order('created_at desc') }
|
||||
|
||||
#filter :jamuser_full_name_or_user_email_cont, label: 'Student Name', as: :string
|
||||
|
||||
#filter :teacher_user_email_cont, label: 'Student Name', as: :string
|
||||
|
||||
filter :student_full_name_or_user_email_cont, label: 'Student Name Or Email', as: :string
|
||||
filter :by_search_teacher_in, label: 'Teacher Name Or Email', as: :string
|
||||
filter :by_lesson_package_type_in, label: 'Card Type', as: :select, collection: -> { LessonPackageType.all.map { |t| [t.admin_name, t.id] } }
|
||||
|
||||
controller do
|
||||
active_admin_config.includes.push :teacher, :music_session
|
||||
end
|
||||
|
||||
action_item :only => [:show] do
|
||||
link_to('Mark As Success', mark_success_admin_lesson_session_path(resource.id))
|
||||
end
|
||||
|
||||
member_action :mark_success, :method => :get do
|
||||
if !resource.success
|
||||
resource.mark_lesson(true, true)
|
||||
end
|
||||
redirect_to :back
|
||||
|
||||
end
|
||||
scope("All", default: true) { |scope| scope.unscoped.order('created_at desc') }
|
||||
scope("Requested" ) { |scope| scope.unscoped.where(status: LessonBooking::STATUS_REQUESTED).order('created_at desc') }
|
||||
scope("Approved") { |scope| scope.unscoped.approved.order('created_at desc') }
|
||||
scope("Suspended" ) { |scope| scope.unscoped.suspended.order('created_at desc') }
|
||||
scope("Canceled" ) { |scope| scope.unscoped.canceled.order('created_at desc') }
|
||||
scope("Missed" ) { |scope| scope.unscoped.missed.order('created_at desc') }
|
||||
scope("Completed" ) { |scope| scope.unscoped.completed.order('created_at desc') }
|
||||
|
||||
index do
|
||||
column "Actions" do |teacher|
|
||||
links = ''.html_safe
|
||||
links << link_to("View", resource_path(teacher), :class => "member_link view_link")
|
||||
links << link_to("Edit", edit_resource_path(teacher), :class => "member_link edit_link")
|
||||
links
|
||||
end
|
||||
column "App Link" do |lesson_session|
|
||||
column "User Link" do |lesson_session|
|
||||
lesson_booking = lesson_session.lesson_booking
|
||||
span do
|
||||
link_to "link", "#{Rails.application.config.external_root_url}/client#/jamclass/lesson-booking/#{lesson_booking.id}"
|
||||
link_to "Web URL", "#{Rails.application.config.external_root_url}/client#/jamclass/lesson-booking/#{lesson_booking.id}"
|
||||
end
|
||||
end
|
||||
column "Status" do |lesson_session|
|
||||
link_to lesson_session.status, admin_lesson_session_path(lesson_session.id)
|
||||
lesson_session.status
|
||||
end
|
||||
column "Start Time" do |lesson_session|
|
||||
span do
|
||||
if lesson_session.music_session.nil?
|
||||
raise "Lessonsesison with no id #{lesson_session.id}"
|
||||
else
|
||||
lesson_session.music_session.pretty_scheduled_start(true)
|
||||
end
|
||||
lesson_session.music_session.pretty_scheduled_start(true)
|
||||
end
|
||||
br
|
||||
span do
|
||||
|
|
@ -75,220 +41,18 @@ ActiveAdmin.register JamRuby::LessonSession, :as => 'LessonSessions' do
|
|||
column "Teacher" do |lesson_session|
|
||||
teacher = lesson_session.teacher
|
||||
span do
|
||||
# link_to "#{teacher.name} (#{teacher.email})", "#{Rails.application.config.external_root_url}/client#/profile/teacher/#{teacher.id}"
|
||||
link_to teacher.admin_name, teacher.admin_url
|
||||
link_to "#{teacher.name} (#{teacher.email})", "#{Rails.application.config.external_root_url}/client#/profile/teacher/#{teacher.id}"
|
||||
end
|
||||
end
|
||||
column "Student" do |lesson_session|
|
||||
student = lesson_session.student
|
||||
span do
|
||||
#link_to "#{student.name} (#{student.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{student.id}"
|
||||
link_to student.admin_name, student.admin_url
|
||||
link_to "#{student.name} (#{student.email})", "#{Rails.application.config.external_root_url}/client#/profile/#{student.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
show do
|
||||
attributes_table do
|
||||
row "Lesson Booking" do |lesson_session|
|
||||
span do
|
||||
link_to "Lesson Booking", lesson_session.lesson_booking.admin_url
|
||||
end
|
||||
end
|
||||
row "App Link" do |lesson_session|
|
||||
lesson_booking = lesson_session.lesson_booking
|
||||
span do
|
||||
link_to "link", "#{Rails.application.config.external_root_url}/client#/jamclass/lesson-booking/#{lesson_booking.id}"
|
||||
end
|
||||
end
|
||||
row "Status" do |lesson_session|
|
||||
lesson_session.status
|
||||
end
|
||||
row "Start Time" do |lesson_session|
|
||||
span do
|
||||
lesson_session.music_session.pretty_scheduled_start(true)
|
||||
end
|
||||
br
|
||||
span do
|
||||
lesson_session.music_session.scheduled_start
|
||||
end
|
||||
end
|
||||
row "Duration" do |lesson_session|
|
||||
lesson_session.duration
|
||||
end
|
||||
row "Teacher" do |lesson_session|
|
||||
teacher = lesson_session.teacher
|
||||
span do
|
||||
# link_to teacher.admin_name, "#{Rails.application.config.external_root_url}/client#/profile/teacher/#{teacher.id}"
|
||||
link_to teacher.admin_name, teacher.admin_url
|
||||
end
|
||||
end
|
||||
row "Student" do |lesson_session|
|
||||
student = lesson_session.student
|
||||
span do
|
||||
# link_to student.admin_name, "#{Rails.application.config.external_root_url}/client#/profile/#{student.id}"
|
||||
link_to student.admin_name, student.admin_url
|
||||
end
|
||||
end
|
||||
row "Followup Emails Sent" do |lesson_session|
|
||||
span do
|
||||
lesson_session.sent_notices
|
||||
end
|
||||
end
|
||||
row "Success" do |lesson_session|
|
||||
span do
|
||||
lesson_session.success
|
||||
end
|
||||
end
|
||||
row "Billed" do |lesson_session|
|
||||
span do
|
||||
if lesson_session.is_test_drive?
|
||||
'N/A (because is Test Drive)'
|
||||
else
|
||||
lesson_session.billed
|
||||
end
|
||||
end
|
||||
end
|
||||
row "Distribution" do |lesson_session|
|
||||
distribution = lesson_session.teacher_distribution
|
||||
|
||||
if distribution
|
||||
payment = distribution.teacher_payment
|
||||
|
||||
if payment
|
||||
charge = payment.teacher_payment_charge
|
||||
end
|
||||
end
|
||||
|
||||
div do
|
||||
if distribution
|
||||
table_for distribution do
|
||||
column :amount_in_cents
|
||||
column :distributed
|
||||
column :ready
|
||||
column :teacher_fee_in_cents
|
||||
column :reduced_roll_forward_amount_in_cents
|
||||
column :created_at
|
||||
column :updated_at
|
||||
column do
|
||||
link_to "Link", distribution.admin_url
|
||||
end
|
||||
end
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
row "Teacher Payment" do |lesson_session|
|
||||
distribution = lesson_session.teacher_distribution
|
||||
|
||||
if distribution
|
||||
payment = distribution.teacher_payment
|
||||
end
|
||||
|
||||
div do
|
||||
if payment
|
||||
table_for payment do
|
||||
column :amount_in_cents
|
||||
column :fee_in_cents
|
||||
column :created_at
|
||||
column :updated_at
|
||||
column do
|
||||
link_to "Link", payment.admin_url
|
||||
end
|
||||
end
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
end
|
||||
row "Stripe Charge" do |lesson_session|
|
||||
distribution = lesson_session.teacher_distribution
|
||||
|
||||
if distribution
|
||||
payment = distribution.teacher_payment
|
||||
if payment
|
||||
charge = payment.teacher_payment_charge
|
||||
end
|
||||
end
|
||||
|
||||
div do
|
||||
if charge
|
||||
table_for charge do
|
||||
column :amount_in_cents
|
||||
column :fee_in_cents
|
||||
column :billed
|
||||
column :billed_at
|
||||
column :post_processed
|
||||
column :post_processed_at
|
||||
column :billing_error_reason
|
||||
column :billing_error_detail
|
||||
column :billing_should_retry
|
||||
column :billing_attempts
|
||||
column :stripe_charge_id
|
||||
column :created_at
|
||||
column :updated_at
|
||||
column do
|
||||
link_to "Stripe", "https://dashboard.stripe.com/payments/#{charge.stripe_charge_id}" if charge.stripe_charge_id
|
||||
end
|
||||
column do
|
||||
link_to "Link", charge.admin_url
|
||||
end
|
||||
end
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
row "Admin Marked" do |lesson_session|
|
||||
span do
|
||||
lesson_session.admin_marked
|
||||
end
|
||||
end
|
||||
row "Description" do |lesson_session|
|
||||
span do
|
||||
lesson_session.timed_description
|
||||
end
|
||||
end
|
||||
row "Session" do |lesson_session|
|
||||
span do
|
||||
link_to "Session", lesson_session.music_session.admin_url
|
||||
end
|
||||
end
|
||||
row "Analysis" do |lesson_session|
|
||||
if lesson_session.analysed
|
||||
span style: "white-space: pre;" do
|
||||
begin
|
||||
JSON.pretty_generate(lesson_session.analysis_json)
|
||||
rescue
|
||||
"barf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
row "Chat Messages" do |lesson_session|
|
||||
div do
|
||||
table_for ChatMessage.unscoped.where(lesson_session: lesson_session).order(:created_at) do
|
||||
column :created_at
|
||||
column do |chat_msg|
|
||||
chat_msg.purpose ? chat_msg.purpose : 'Chat Msg'
|
||||
end
|
||||
column 'Sender' do |chat_msg|
|
||||
link_to(chat_msg.user.name, chat_msg.user.admin_url)
|
||||
end
|
||||
column :target_user do |chat_msg|
|
||||
chat_msg.target_user ? link_to(chat_msg.target_user.name, chat_msg.target_user.admin_url) : ''
|
||||
end
|
||||
column :message
|
||||
column :id
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::LiveStream, :as => 'LiveStream' do
|
||||
menu :parent => 'Misc'
|
||||
|
||||
config.sort_order = 'created_at DESC'
|
||||
|
||||
filter :listed
|
||||
filter :event_id
|
||||
|
||||
before_build do |record|
|
||||
if !record.event_type.nil?
|
||||
puts "escape"
|
||||
else
|
||||
record.slug = 'please-do-this-sort-of-thing'
|
||||
record.starts_at = 10.days.from_now.midnight
|
||||
record.ends_at = 11.days.from_now.midnight
|
||||
record.event_type = 'eventbrite'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -5,31 +5,31 @@ ActiveAdmin.register_page "Monthly Stats" do
|
|||
content :title => "Monthly Stats" do
|
||||
h2 "Distinct Users Playing in Sessions"
|
||||
table_for MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', msuh.created_at)::date as month, count(distinct(user_id)) from music_sessions_user_history msuh group by month order by month desc;") do
|
||||
column "Month", Proc.new { |row| row.month.strftime('%B %Y') }
|
||||
column "Month", Proc.new { |row| Date.parse(row.month).strftime('%B %Y') }
|
||||
column "Users", :count
|
||||
end
|
||||
|
||||
h2 "Music Sessions"
|
||||
table_for MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', ms.created_at)::date as month, count(id) from music_sessions ms where started_at is not null group by month order by month desc;") do
|
||||
column "Month", Proc.new { |row| row.month.strftime('%B %Y') }
|
||||
column "Month", Proc.new { |row| Date.parse(row.month).strftime('%B %Y') }
|
||||
column "Sessions", :count
|
||||
end
|
||||
|
||||
h2 "Distinct Users Who Played with a JamTrack"
|
||||
table_for MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', jts.created_at)::date as month, count(distinct(user_id)) from jam_track_sessions jts group by month order by month desc;") do
|
||||
column "Month", Proc.new { |row| row.month.strftime('%B %Y') }
|
||||
column "Month", Proc.new { |row| Date.parse(row.month).strftime('%B %Y') }
|
||||
column "Users", :count
|
||||
end
|
||||
|
||||
h2 "Music Sessions with JamTracks Played"
|
||||
table_for MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', jts.created_at)::date as month, count(distinct(music_session_id)) from jam_track_sessions jts where session_type = 'session' group by month order by month desc;") do
|
||||
column "Month", Proc.new { |row| row.month.strftime('%B %Y') }
|
||||
column "Month", Proc.new { |row| Date.parse(row.month).strftime('%B %Y') }
|
||||
column "Sessions", :count
|
||||
end
|
||||
|
||||
h2 "JamTrack Web Player Sessions"
|
||||
table_for MusicSession.select([:month, :count]).find_by_sql("select date_trunc('month', jts.created_at)::date as month, count(id) from jam_track_sessions jts where session_type = 'browser' group by month order by month desc;") do
|
||||
column "Month", Proc.new { |row| row.month.strftime('%B %Y') }
|
||||
column "Month", Proc.new { |row| Date.parse(row.month).strftime('%B %Y') }
|
||||
column "Sessions", :count
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -60,51 +60,4 @@ ActiveAdmin.register JamRuby::MusicSession, :as => 'Music Session' do
|
|||
end
|
||||
end
|
||||
|
||||
show do
|
||||
attributes_table do
|
||||
row :id
|
||||
row :name
|
||||
row :description
|
||||
row :creator do |session|
|
||||
link_to(session.creator.admin_name, session.creator.admin_url)
|
||||
end
|
||||
row :created_at
|
||||
row :started_at
|
||||
row :session_ended_at do |session| session.session_removed_at end
|
||||
row :genre
|
||||
row :recurring_mode
|
||||
row :timezone
|
||||
row :fan_access
|
||||
row :music_access
|
||||
row :approval_required
|
||||
row :open_rsvps
|
||||
row :is_unstructured_rsv
|
||||
row :canceled
|
||||
row :lesson_session do |session|
|
||||
lesson_session = session.lesson_session
|
||||
if lesson_session
|
||||
link_to("Lesson", lesson_session.admin_url)
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
row 'Session Attendances' do |session|
|
||||
|
||||
table_for(msuh = session.music_session_user_histories) do
|
||||
column :user do |msuh| msuh.user.admin_name end
|
||||
column :joined do |msuh| msuh.created_at.strftime('%b %d %Y, %H:%M') end
|
||||
column :duration do |msuh| "#{msuh.duration_minutes.round} minutes" end
|
||||
column :perf_data do |msuh|
|
||||
unless (uu = msuh.perf_uri).blank?
|
||||
link_to('Per Data Link', uu)
|
||||
else
|
||||
'No Perf Data'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::User, :as => 'Onboarder' do
|
||||
|
||||
menu :label => 'Onboarder Settings', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at'
|
||||
config.batch_actions = true
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = false
|
||||
config.clear_action_items!
|
||||
batch_action :destroy, false
|
||||
|
||||
scope("All Onboarders", default: true) { |scope| scope.where(is_onboarder: true).order(:created_at) }
|
||||
|
||||
controller do
|
||||
active_admin_config.includes.push :onboarding_users
|
||||
|
||||
def update
|
||||
resource.max_onboardings = params[:jam_ruby_user][:max_onboardings]
|
||||
resource.save!
|
||||
success.json {}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
index do
|
||||
def last_week
|
||||
@last_week_result ||= calculate_last_week
|
||||
end
|
||||
|
||||
def calculate_last_week
|
||||
start_day = Date.today.beginning_of_week(:sunday).yesterday.beginning_of_week(:sunday)
|
||||
end_day = start_day.end_of_week(:sunday)
|
||||
result = [start_day, end_day]
|
||||
result
|
||||
end
|
||||
|
||||
def this_week
|
||||
@this_week_result ||= calculate_this_week
|
||||
end
|
||||
|
||||
def calculate_this_week
|
||||
start_day = Date.today.beginning_of_week(:sunday)
|
||||
end_day = start_day.end_of_week(:sunday)
|
||||
result = [start_day, end_day]
|
||||
result
|
||||
end
|
||||
|
||||
def week_display(week)
|
||||
start_day = week[0]
|
||||
end_day = week[1]
|
||||
mmyy = start_day.strftime('%b')
|
||||
"#{mmyy} #{start_day.day}-#{end_day.day}"
|
||||
end
|
||||
|
||||
def onboarding_select
|
||||
array = []
|
||||
100.times do |i|
|
||||
array.push [i.to_s, i.to_s]
|
||||
end
|
||||
array
|
||||
end
|
||||
column "Name" do |user|
|
||||
div do
|
||||
div do
|
||||
link_to user.name, user.admin_url
|
||||
end
|
||||
div do
|
||||
user.email
|
||||
end
|
||||
end
|
||||
end
|
||||
column "Max Onboardings" do |user|
|
||||
best_in_place user, :max_onboardings, as: :select, url: admin_onboarder_path(user),:collection => onboarding_select
|
||||
end
|
||||
column "Current Week #{week_display(this_week)}" do |user|
|
||||
start_date, last_date = this_week
|
||||
user.onboarding_users.where(onboarder_assigned_at: start_date..last_date).count
|
||||
end
|
||||
column "Previous Week #{week_display(last_week)}" do |user|
|
||||
start_date, last_date = last_week
|
||||
user.onboarding_users.where(onboarder_assigned_at: start_date..last_date).count
|
||||
end
|
||||
column "Current Student WIP" do |user|
|
||||
user.onboarding_users.where('onboarding_status = ? OR onboarding_status = ?', User::ONBOARDING_STATUS_ASSIGNED, User::ONBOARDING_STATUS_EMAILED).count
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::User, :as => 'OnboarderManagement' do
|
||||
|
||||
menu :label => 'Onboarder Management', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = true
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = true
|
||||
config.clear_action_items!
|
||||
batch_action :destroy, false
|
||||
|
||||
batch_action :onboarder, form: -> { {
|
||||
support_consultant: (User.where(is_onboarder: true).includes(:onboarding_users).map {|user| ["#{user.name} (#{user.onboarding_users.where('onboarding_status = ? OR onboarding_status = ?', User::ONBOARDING_STATUS_ASSIGNED, User::ONBOARDING_STATUS_EMAILED).count})", user.id]}).to_a.unshift(['Unassign', ''])
|
||||
} } do |ids, inputs|
|
||||
onboarder = inputs[:support_consultant]
|
||||
if onboarder.blank?
|
||||
onboarder = nil
|
||||
else
|
||||
onboarder = User.find(onboarder)
|
||||
end
|
||||
|
||||
ids.each do |id|
|
||||
user = User.find(id)
|
||||
user.onboarder = onboarder
|
||||
user.onboarder_assigned_at = Date.today
|
||||
user.save
|
||||
end
|
||||
|
||||
if onboarder
|
||||
msg = 'Assigned ' + User.find(onboarder).name + " to #{ids.length} users"
|
||||
|
||||
else
|
||||
msg = "Unassigned any Support Consultant from #{ids.length} users"
|
||||
end
|
||||
|
||||
redirect_to :back, notice: msg
|
||||
end
|
||||
|
||||
filter :jamuser_full_name_or_email_cont, label: 'Name Or Email', as: :string
|
||||
filter :onboarder, as: :select, :collection => User.where(is_onboarder: true), label: 'Support Consultant'
|
||||
filter :onboarder_id_blank, :as => :boolean, label: 'Unassigned'
|
||||
filter :onboarding_escalation_reason_present, :as => :boolean, label: 'Escalated'
|
||||
scope("Unassigned", default: true) { |scope| scope.joins(:posa_cards).where(onboarding_status: User::ONBOARDING_STATUS_UNASSIGNED).where('posa_cards.lesson_package_type_id in (?)', LessonPackageType::AMAZON_PACKAGES + LessonPackageType::LESSON_PACKAGE_TYPES) }
|
||||
scope("Escalated") { |scope| scope.joins(:posa_cards).where('onboarding_status = ?', User::ONBOARDING_STATUS_ESCALATED).where('posa_cards.lesson_package_type_id in (?)', LessonPackageType::AMAZON_PACKAGES + LessonPackageType::LESSON_PACKAGE_TYPES) }
|
||||
scope("Needs Manual Email") { |scope| scope.joins(:posa_cards).where(onboarding_status: User::ONBOARDING_STATUS_ONBOARDED).where('(stuck_take_flesson = TRUE AND sent_admin_take_flesson_email_at is NULL) OR (stuck_take_2nd_flesson = TRUE AND sent_admin_take_2nd_flesson_email_at IS NULL) OR (stuck_take_plesson = TRUE AND sent_admin_take_plesson_email_at IS NULL)').where('posa_cards.lesson_package_type_id in (?)', LessonPackageType::AMAZON_PACKAGES + LessonPackageType::LESSON_PACKAGE_TYPES) }
|
||||
scope("Assigned") { |scope| scope.joins(:posa_cards).where('onboarding_status = ? OR onboarding_status = ?', User::ONBOARDING_STATUS_ASSIGNED, User::ONBOARDING_STATUS_EMAILED).where('posa_cards.lesson_package_type_id in (?)', LessonPackageType::AMAZON_PACKAGES + LessonPackageType::LESSON_PACKAGE_TYPES) }
|
||||
scope("All TestDrive/Amazon Users") { |scope| scope.joins(:posa_cards).where('posa_cards.lesson_package_type_id in (?)', LessonPackageType::AMAZON_PACKAGES + LessonPackageType::LESSON_PACKAGE_TYPES) }
|
||||
|
||||
|
||||
controller do
|
||||
active_admin_config.includes.push :onboarding_users
|
||||
end
|
||||
|
||||
index do
|
||||
selectable_column
|
||||
column "Name" do |user|
|
||||
link_to user.name, user.admin_url
|
||||
end
|
||||
column :email
|
||||
column :onboarding_status
|
||||
column "Lost Reason", :onboarding_lost_reason
|
||||
column "Escalated Reason", :onboarding_escalation_reason
|
||||
column "Support Consultant" do |user|
|
||||
if user.onboarder
|
||||
link_to "#{user.onboarder.name} (#{user.onboarder.onboarding_users.where('onboarding_status = ? OR onboarding_status = ?', User::ONBOARDING_STATUS_ASSIGNED, User::ONBOARDING_STATUS_EMAILED).count})", user.onboarder.admin_url
|
||||
else
|
||||
end
|
||||
end
|
||||
column "Manual Email Needed" do |user|
|
||||
|
||||
div do
|
||||
if user.stuck_take_plesson
|
||||
link_to("sent take paid lesson email", mark_sent_paid_lesson_admin_onboarder_management_path(user.id), {'data-confirm': "You sent an email manually to the user to remind them to take a paid lesson?"})
|
||||
elsif user.stuck_take_2nd_flesson
|
||||
link_to("sent take 2nd lesson email", mark_sent_2nd_free_lesson_admin_onboarder_management_path(user.id), {'data-confirm': "You sent an email manually to the user to remind them to take 2nd free lesson?"})
|
||||
elsif user.stuck_take_flesson
|
||||
link_to("sent take 1st lesson email", mark_sent_1st_free_lesson_admin_onboarder_management_path(user.id), {'data-confirm': "You sent an email manually to the user to remind them to take a 1st free lesson?"})
|
||||
else
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
column "Signup" do |user|
|
||||
user.created_at.to_date
|
||||
end
|
||||
column "Assigned", :onboarder_assigned_at
|
||||
column "Email 1", :onboarding_email_1_sent_at
|
||||
column "Email 2", :onboarding_email_2_sent_at
|
||||
column "Email 3", :onboarding_email_3_sent_at
|
||||
column "Email 4", :onboarding_email_4_sent_at
|
||||
column "Email 5", :onboarding_email_5_sent_at
|
||||
column "Test Session", :onboarding_test_session_scheduled_at
|
||||
column "Admin Actions" do |user|
|
||||
div do
|
||||
if user.is_waiting_onboarding || user.is_onboarding
|
||||
link_to("mark onboarded", mark_onboarded_admin_onboarder_management_path(user.id), { 'data-confirm': "Mark onboarded?"})
|
||||
end
|
||||
if user.is_waiting_onboarding || user.is_onboarding
|
||||
link_to("mark lost", mark_lost_admin_onboarder_management_path(user.id), { 'data-confirm': "Mark lost (reason = Other)?"})
|
||||
end
|
||||
end
|
||||
end
|
||||
column "Onboarder Notes", :onboarding_onboarder_notes
|
||||
end
|
||||
|
||||
member_action :update_onboarder, :method => :post do
|
||||
resource.onboarder = params[:onboarder]
|
||||
resource.save!
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
member_action :mark_sent_paid_lesson, :method => :get do
|
||||
resource.mark_sent_paid_lesson
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
member_action :mark_sent_2nd_free_lesson, :method => :get do
|
||||
resource.mark_sent_2nd_free_lesson
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
member_action :mark_sent_1st_free_lesson, :method => :get do
|
||||
resource.mark_sent_1st_free_lesson
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
member_action :mark_onboarded, :method => :get do
|
||||
resource.mark_onboarded
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
member_action :mark_lost, :method => :get do
|
||||
resource.mark_lost
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
ActiveAdmin.register_page "POSA Card Uploads" do
|
||||
|
||||
menu :label => 'Posa Cards Upload', :parent => 'JamClass'
|
||||
|
||||
page_action :upload_posacards, :method => :post do
|
||||
PosaCard.transaction do
|
||||
|
||||
puts params
|
||||
|
||||
file = params[:jam_ruby_posa_card][:csv]
|
||||
array_of_arrays = CSV.read(file.tempfile.path)
|
||||
array_of_arrays.each do |row|
|
||||
if row.length != 5
|
||||
raise "UKNONWN CSV FORMAT! Must be 5 columns"
|
||||
end
|
||||
|
||||
code = row[0]
|
||||
lesson_package_type = row[1]
|
||||
preactivate = row[2].strip.downcase == "true"
|
||||
requires_purchase = row[3].downcase== "true"
|
||||
is_test = row[4].strip.downcase == "true"
|
||||
|
||||
posa_card = PosaCard.new
|
||||
posa_card.code = code
|
||||
posa_card.lesson_package_type = LessonPackageType.find(lesson_package_type)
|
||||
posa_card.preactivate = preactivate
|
||||
posa_card.requires_purchase = requires_purchase
|
||||
posa_card.purchased = !requires_purchase
|
||||
posa_card.card_type = params[:jam_ruby_posa_card][:card_type]
|
||||
posa_card.is_test = is_test
|
||||
|
||||
|
||||
if posa_card.card_type == PosaCard::JAM_CLASS_4
|
||||
posa_card.is_lesson = true
|
||||
posa_card.credits = 4
|
||||
elsif posa_card.card_type == PosaCard::JAM_CLASS_2
|
||||
posa_card.is_lesson = true
|
||||
posa_card.credits = 2
|
||||
end
|
||||
posa_card.origin = file .original_filename
|
||||
posa_card.save!
|
||||
end
|
||||
|
||||
redirect_to admin_posa_card_uploads_path, :notice => "Created #{array_of_arrays.length} POSA cards!"
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
=begin
|
||||
form :html => {:multipart => true} do |f|
|
||||
f.inputs "Details" do
|
||||
f.input :version, :hint => "Should match Jenkins build number of artifact"
|
||||
f.input :environment, :hint => "Typically just 'public'"
|
||||
f.input :product, :as => :select, :collection => JamRuby::ArtifactUpdate::PRODUCTS
|
||||
end
|
||||
f.inputs "Artifact Upload" do
|
||||
f.input :uri, :as => :file, :hint => "Upload the artifact from Jenkins"
|
||||
end
|
||||
|
||||
f.actions
|
||||
|
||||
end
|
||||
|
||||
# fr manual entry of huge CSVs from rails c command line
|
||||
|
||||
PosaCard.transaction do
|
||||
|
||||
|
||||
array_of_arrays = CSV.read('codes.csv')
|
||||
array_of_arrays.each do |row|
|
||||
if row.length != 5
|
||||
raise "UKNONWN CSV FORMAT! Must be 5 columns"
|
||||
end
|
||||
|
||||
code = row[0]
|
||||
lesson_package_type = row[1]
|
||||
preactivate = row[2].strip.downcase == "true"
|
||||
requires_purchase = row[3].downcase== "true"
|
||||
is_test = row[4].strip.downcase == "true"
|
||||
|
||||
posa_card = PosaCard.new
|
||||
posa_card.code = code
|
||||
posa_card.lesson_package_type = LessonPackageType.find(lesson_package_type)
|
||||
posa_card.preactivate = preactivate
|
||||
posa_card.requires_purchase = requires_purchase
|
||||
posa_card.purchased = !requires_purchase
|
||||
posa_card.card_type = 'jam_class_2'
|
||||
posa_card.is_test = is_test
|
||||
|
||||
|
||||
if posa_card.card_type == PosaCard::JAM_CLASS_4
|
||||
posa_card.is_lesson = true
|
||||
posa_card.credits = 4
|
||||
elsif posa_card.card_type == PosaCard::JAM_CLASS_2
|
||||
posa_card.is_lesson = true
|
||||
posa_card.credits = 2
|
||||
end
|
||||
posa_card.origin = 'posa-cards-amazon-test-drive-paid-4-50k.csv'
|
||||
posa_card.save!
|
||||
end
|
||||
end
|
||||
=end
|
||||
|
||||
content do
|
||||
active_admin_form_for PosaCard.new, :url => admin_posa_card_uploads_upload_posacards_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
f.inputs "Upload POSA Cards" do
|
||||
f.input :csv, as: :file, required: true, :label => "A single column CSV that contains ONE type of gift card (5 JamTrack, 10 JamTrack, 4 JamClass etc)"
|
||||
f.input :card_type, required:true, as: :select, :collection => JamRuby::PosaCard::CARD_TYPES
|
||||
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ ActiveAdmin.register JamRuby::PromoBuzz, :as => 'Buzz' do
|
|||
column 'State' do |pp| pp.aasm_state end
|
||||
column 'Position' do |pp| pp.position end
|
||||
column 'Updated' do |pp| pp.updated_at end
|
||||
actions
|
||||
default_actions
|
||||
end
|
||||
|
||||
show do
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ ActiveAdmin.register JamRuby::PromoLatest, :as => 'Latest' do
|
|||
column 'State' do |pp| pp.aasm_state end
|
||||
column 'Position' do |pp| pp.position end
|
||||
column 'Updated' do |pp| pp.updated_at end
|
||||
actions
|
||||
default_actions
|
||||
end
|
||||
|
||||
show do
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ ActiveAdmin.register JamRuby::RecurlyTransactionWebHook, :as => 'RecurlyHooks'
|
|||
|
||||
index do
|
||||
|
||||
actions
|
||||
default_actions
|
||||
|
||||
column :transaction_type
|
||||
column :transaction_at
|
||||
|
|
|
|||
|
|
@ -25,22 +25,14 @@ ActiveAdmin.register JamRuby::SaleLineItem, :as => 'Sale Line Items' do
|
|||
link_to("#{oo.affiliate_referral.display_name} #{oo.affiliate_referral_fee_in_cents ? "#{oo.affiliate_referral_fee_in_cents}\u00A2" : ''}", oo.affiliate_referral.admin_url, {:title => oo.affiliate_referral.display_name}) if oo.affiliate_referral
|
||||
end
|
||||
column 'User' do |oo|
|
||||
if oo.sale.user
|
||||
link_to(oo.sale.user.name, admin_user_path(oo.sale.user.id), {:title => oo.sale.user.name})
|
||||
end
|
||||
link_to(oo.sale.user.name, admin_user_path(oo.sale.user.id), {:title => oo.sale.user.name})
|
||||
end
|
||||
column 'Source' do |oo|
|
||||
if oo.sale.source == JamRuby::Sale::SOURCE_PAYPAL
|
||||
link_to(oo.sale.source, 'https://history.paypal.com/webscr?cmd=_history-details-from-hub&id=' + oo.sale.recurly_invoice_id)
|
||||
else
|
||||
oo.sale.source
|
||||
end
|
||||
oo.sale.source
|
||||
end
|
||||
column 'When' do |oo|
|
||||
oo.created_at
|
||||
end
|
||||
column 'Link' do |oo|
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,129 +0,0 @@
|
|||
ActiveAdmin.register_page "SchoolUserUploads" do
|
||||
|
||||
menu :label => 'School User Upload', :parent => 'Misc'
|
||||
|
||||
page_action :upload_schooluseruploads, :method => :post do
|
||||
User.transaction do
|
||||
|
||||
puts params
|
||||
|
||||
@client = RecurlyClient.new
|
||||
|
||||
file = params[:jam_ruby_user][:csv]
|
||||
|
||||
created = 0
|
||||
errors = 0
|
||||
updated = 0
|
||||
skipped = 0
|
||||
array_of_arrays = CSV.read(file.tempfile.path, headers: true, encoding: 'bom|utf-8')
|
||||
array_of_arrays.each do |row|
|
||||
school_name = row['School Name'].strip
|
||||
school_tag = row['School ID'].strip
|
||||
school = School.autocreate_find_from_upload(school_name, school_tag)
|
||||
first_name = row['First Name'].strip
|
||||
last_name = row['Last Name'].strip
|
||||
email_address = row['Email Address'].strip.downcase
|
||||
license_start = parse_date(row['License Start Date'].strip)
|
||||
license_end = parse_date(row['License End Date'].strip)
|
||||
source = row['Source'].strip
|
||||
password = SecureRandom.uuid
|
||||
options = {
|
||||
first_name: first_name,
|
||||
last_name: last_name,
|
||||
email: email_address,
|
||||
license_start: license_start,
|
||||
license_end: license_end,
|
||||
import_source: source,
|
||||
school_id: school.id,
|
||||
terms_of_service: true,
|
||||
musician: true,
|
||||
skip_recaptcha: true,
|
||||
password: password,
|
||||
password_confirmation: password
|
||||
}
|
||||
|
||||
parse_user_type(row['User Type'].strip, options)
|
||||
|
||||
instrument = Instrument.find('electric guitar')
|
||||
instruments= [{instrument_id: instrument.id, proficiency_level: 3, priority: 1}]
|
||||
options[:instruments] = instruments
|
||||
|
||||
existing = User.find_by_email(options[:email])
|
||||
|
||||
if existing
|
||||
if existing.import_source.nil?
|
||||
if options[:student]
|
||||
existing.school = school
|
||||
existing.is_a_student = true
|
||||
existing.import_source = options[:import_source]
|
||||
existing.license_start = options[:license_start]
|
||||
existing.license_end = options[:license_end]
|
||||
elsif options[:teacher]
|
||||
existing.school = school
|
||||
existing.import_source = options[:import_source]
|
||||
existing.license_start = options[:license_start]
|
||||
existing.license_end = options[:license_end]
|
||||
if existing.teacher.nil?
|
||||
existing.teacher = Teacher.build_teacher(existing, validate_introduction: true, biography: "Empty biography", school_id: school.id)
|
||||
end
|
||||
elsif options[:platform_instructor]
|
||||
existing.import_source = options[:import_source]
|
||||
existing.is_platform_instructor = true
|
||||
existing.license_start = options[:license_start]
|
||||
existing.license_end = options[:license_end]
|
||||
end
|
||||
|
||||
existing.save
|
||||
|
||||
if existing.errors.any?
|
||||
puts "User #{user.name} #{user.email} had errors"
|
||||
puts user.errors.inspect
|
||||
errors = errors + 1
|
||||
else
|
||||
@client.sync_subscription(existing)
|
||||
updated = updated + 1
|
||||
if options[:student]
|
||||
UserMailer.school_welcome_message(existing, nil).deliver_now
|
||||
elsif options[:teacher]
|
||||
UserMailer.school_welcome_message(existing, nil).deliver_now
|
||||
elsif options[:platform_instructor]
|
||||
|
||||
end
|
||||
end
|
||||
else
|
||||
skipped = skipped + 1
|
||||
end
|
||||
else
|
||||
user = User.signup(options)
|
||||
|
||||
if user.errors.any?
|
||||
puts "User #{user.name} #{user.email} had errors"
|
||||
puts user.errors.inspect
|
||||
errors = errors + 1
|
||||
else
|
||||
@client.sync_subscription(user)
|
||||
puts "User #{user.email} created"
|
||||
created = created + 1
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
redirect_to admin_schooluseruploads_path, :notice => "Created #{created}. Updated #{updated}. Errors #{errors}. Skipped #{skipped}"
|
||||
end
|
||||
end
|
||||
|
||||
content do
|
||||
panel "Help" do
|
||||
link_to "Download Sample CSV", asset_path("Sample_School_User_Upload.csv", target: "_blank", download: "Sample_School_User_Upload.csv")
|
||||
end
|
||||
|
||||
active_admin_form_for User.new, :url => admin_schooluseruploads_upload_schooluseruploads_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
f.inputs "Upload School Users" do
|
||||
f.input :csv, as: :file, required: true, :label => "A school user upload"
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::School, :as => 'Schools' do
|
||||
|
||||
menu :label => 'Schools', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at asc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = false
|
||||
|
||||
index do
|
||||
|
||||
actions
|
||||
|
||||
column "Name" do |school|
|
||||
school.name
|
||||
end
|
||||
column "Owner" do |school|
|
||||
link_to school.owner.name, "#{Rails.application.config.external_root_url}/client#/profile/#{school.owner.id}"
|
||||
end
|
||||
column "Scheduling Communication" do |school|
|
||||
school.scheduling_communication
|
||||
end
|
||||
column "Correspondence Email" do |school|
|
||||
school.correspondence_email
|
||||
end
|
||||
|
||||
column "Base Fee Rate" do |school|
|
||||
school.jamkazam_rate
|
||||
end
|
||||
column "JamKazam Sourced Fee Rate" do |school|
|
||||
school.base_rate
|
||||
end
|
||||
column "Is Education?" do |school|
|
||||
school.education ? 'Yes' : ''
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::LessonSession, :as => 'SlowResponses' do
|
||||
|
||||
menu :label => 'Slow Responses', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = true
|
||||
|
||||
filter :intervened_at_null, label: 'Not Yet Intervened', as: :boolean
|
||||
|
||||
scope("72 hours since last request/counter", default: true) { |scope| scope.slow_responses }
|
||||
|
||||
member_action :cancel_lesson, :method => :get do
|
||||
result = resource.cancel_by_admin
|
||||
|
||||
if result.errors.any?
|
||||
redirect_to :back, notice: resource.errors.inspect
|
||||
else
|
||||
redirect_to :back, notice: 'Canceled lesson'
|
||||
end
|
||||
end
|
||||
|
||||
member_action :intervened, :method => :get do
|
||||
resource.intervened
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
index do
|
||||
column "Not Responded" do |lesson_session|
|
||||
div do
|
||||
if lesson_session.student_last_proposed?
|
||||
"Teacher"
|
||||
else
|
||||
"Student"
|
||||
end
|
||||
end
|
||||
div do
|
||||
late_responder = lesson_session.late_responder
|
||||
span do
|
||||
link_to "#{late_responder.name}", late_responder.admin_url
|
||||
end
|
||||
end
|
||||
div do
|
||||
lesson_session.late_responder.email
|
||||
end
|
||||
end
|
||||
column "Proposer" do |lesson_session|
|
||||
div do
|
||||
if lesson_session.student_last_proposed?
|
||||
"Student"
|
||||
else
|
||||
"Teacher"
|
||||
end
|
||||
end
|
||||
div do
|
||||
last_proposer = lesson_session.last_proposer
|
||||
span do
|
||||
link_to "#{last_proposer.name}", last_proposer.admin_url
|
||||
end
|
||||
end
|
||||
div do
|
||||
lesson_session.last_proposer.email
|
||||
end
|
||||
end
|
||||
column "Lesson Type" do |lesson_session|
|
||||
lesson_session.display_type
|
||||
end
|
||||
column "Proposed Start Time" do |lesson_session|
|
||||
span do
|
||||
if lesson_session.music_session.nil?
|
||||
raise "Lessonsesison with no id #{lesson_session.id}"
|
||||
else
|
||||
link_to lesson_session.music_session.pretty_scheduled_start(true), lesson_session.admin_url
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
column "Days with no response" do |lesson_session|
|
||||
if lesson_session.last_response_time.nil?
|
||||
'N/A'
|
||||
else
|
||||
"#{((Time.now - lesson_session.last_response_time) / 24 / 3600).floor} days"
|
||||
end
|
||||
end
|
||||
column "Num Reqs/Counters" do |lesson_session|
|
||||
ChatMessage.unscoped.where(lesson_session_id: lesson_session.id).where('purpose = ? OR purpose = ?', "Lesson Requested", "New Time Proposed").count(:purpose)
|
||||
end
|
||||
column "Intervene" do |lesson_session|
|
||||
span do
|
||||
if lesson_session.intervened_at
|
||||
lesson_session.intervened_at.to_date
|
||||
else
|
||||
link_to("intervened", intervened_admin_slow_response_path(lesson_session.id), {confirm: "Mark Lesson as 'Intervened' (i.e., email sent to by hand)?"})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
column "Cancel Lesson" do |lesson_session|
|
||||
span do
|
||||
link_to("cancel", cancel_lesson_admin_slow_response_path(lesson_session.id), {confirm: "Cancel Lesson?"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -6,21 +6,16 @@ ActiveAdmin.register JamRuby::User, :as => 'Students' do
|
|||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = true
|
||||
|
||||
def booked_anything(scope)
|
||||
def booked_anything(scope)
|
||||
scope.joins(:student_lesson_bookings).where('lesson_bookings.active = true').uniq
|
||||
end
|
||||
|
||||
filter :jamuser_full_name_or_email_cont, label: 'Name Or Email', as: :string
|
||||
filter :school, label: 'School'
|
||||
|
||||
scope("TestDrive/Amazon Users", default: true) {|scope| scope.joins(:posa_cards).where('posa_cards.lesson_package_type_id in (?)', LessonPackageType::AMAZON_PACKAGES + LessonPackageType::LESSON_PACKAGE_TYPES) }
|
||||
scope("Student Or Has Credits Or Has Lesson") { |scope| scope.where('is_a_student = true OR jamclass_credits > 0 OR ((select count(id) from lesson_bookings where lesson_bookings.user_id = users.id) > 0)').order('users.ready_for_session_at IS NULL DESC') }
|
||||
scope("Default", default: true) { |scope| booked_anything(scope).order('ready_for_session_at IS NULL DESC') }
|
||||
|
||||
index do
|
||||
column "Name" do |user|
|
||||
link_to user.name, user.admin_url
|
||||
link_to user.name, "#{Rails.application.config.external_root_url}/client#/profile/#{user.id}"
|
||||
end
|
||||
column "Email" do |user|
|
||||
user.email
|
||||
|
|
@ -50,11 +45,10 @@ ActiveAdmin.register JamRuby::User, :as => 'Students' do
|
|||
end
|
||||
end
|
||||
column "School" do |user|
|
||||
if user.school
|
||||
user.school.name
|
||||
if teacher.school
|
||||
teacher.school.name
|
||||
end
|
||||
end
|
||||
column :updated_at
|
||||
end
|
||||
|
||||
member_action :mark_session_ready, :method => :get do
|
||||
|
|
@ -62,11 +56,4 @@ ActiveAdmin.register JamRuby::User, :as => 'Students' do
|
|||
redirect_to :back
|
||||
end
|
||||
|
||||
|
||||
member_action :mark_session_not_ready, :method => :get do
|
||||
resource.mark_session_not_ready
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
ActiveAdmin.register User, :as => 'User_Override' do
|
||||
|
||||
menu :label => 'Subscription', :parent => 'Users'
|
||||
|
||||
form title: 'Use This To Give a No-Payment Subscription' do |f|
|
||||
inputs 'Details' do
|
||||
input :admin_override_touch, :as => :hidden, value: 'true'
|
||||
input :admin_override_reason, :as => :text
|
||||
input :admin_override_plan_code, :as => :select, :collection => SubscriptionDefinitions::MONTHLY_PLANS + ['Remove Override']
|
||||
input :admin_override_ends_at, as: :datepicker,
|
||||
datepicker_options: {
|
||||
min_date: Date.today,
|
||||
max_date: "+10Y"
|
||||
}
|
||||
li "User has admin override set to #{f.object.admin_override_plan_code}. Lasts until #{f.object.admin_override_ends_at}" if !f.object.admin_override_plan_code.nil?
|
||||
li "User does not have admin override. They are currently on the #{f.object.subscription_plan_code ? f.object.subscription_plan_code : 'Free'} plan" if f.object.admin_override_plan_code.nil?
|
||||
end
|
||||
panel 'Instructions' do
|
||||
"If you select a plan, the user will have their current subscription (if any) cancelled and set to the new plan for free. If you instead select Remove Override, you can cancel the gifted plan and the user will be o normal free-tier user again."
|
||||
end
|
||||
para "Press cancel to return to the list without saving."
|
||||
actions
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::TeacherDistribution, :as => 'TeacherDistributions' do
|
||||
|
||||
menu :label => 'Teacher Distributions', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = true
|
||||
|
||||
controller do
|
||||
active_admin_config.includes.push :teacher
|
||||
end
|
||||
|
||||
filter :teacher_full_name_or_teacher_email_cont, label: 'Name', as: :string
|
||||
|
||||
index do
|
||||
column "Actions" do |distribution|
|
||||
links = ''.html_safe
|
||||
links << link_to("View", resource_path(distribution), :class => "member_link view_link")
|
||||
links << link_to("Edit", edit_resource_path(distribution), :class => "member_link edit_link")
|
||||
links
|
||||
end
|
||||
column "Teacher" do |distribution|
|
||||
link_to distribution.teacher.name, distribution.teacher.admin_url
|
||||
end
|
||||
column :amount_in_cents
|
||||
column :distributed
|
||||
column :ready
|
||||
column :teacher_fee_in_cents
|
||||
column :reduced_roll_forward_amount_in_cents
|
||||
column :created_at
|
||||
column :updated_at
|
||||
end
|
||||
|
||||
show do
|
||||
attributes_table do
|
||||
row "Teacher" do |distribution|
|
||||
link_to distribution.teacher.name, distribution.teacher.admin_url
|
||||
end
|
||||
row :amount_in_cents
|
||||
row :distributed
|
||||
row :ready
|
||||
row :teacher_fee_in_cents
|
||||
row :reduced_roll_forward_amount_in_cents
|
||||
row :created_at
|
||||
row :updated_at
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::TeacherPayment, :as => 'TeacherPayments' do
|
||||
|
||||
menu :label => 'Teacher Payments', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = true
|
||||
|
||||
controller do
|
||||
active_admin_config.includes.push :teacher
|
||||
end
|
||||
|
||||
filter :teacher_full_name_or_teacher_email_cont, label: 'Name', as: :string
|
||||
|
||||
index do
|
||||
column "Actions" do |payment|
|
||||
links = ''.html_safe
|
||||
links << link_to("View", resource_path(payment), :class => "member_link view_link")
|
||||
links << link_to("Edit", edit_resource_path(payment), :class => "member_link edit_link")
|
||||
links
|
||||
end
|
||||
column "Teacher" do |payment|
|
||||
link_to payment.teacher.name, payment.teacher.admin_url
|
||||
end
|
||||
column :amount_in_cents
|
||||
column :fee_in_cents
|
||||
column :created_at
|
||||
column :updated_at
|
||||
end
|
||||
|
||||
show do
|
||||
attributes_table do
|
||||
row "Teacher" do |payment|
|
||||
link_to payment.teacher.name, payment.teacher.admin_url
|
||||
end
|
||||
row :amount_in_cents
|
||||
row :fee_in_cents
|
||||
row :created_at
|
||||
row :updated_at
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,26 +1,17 @@
|
|||
ActiveAdmin.register JamRuby::Teacher, :as => 'Teachers' do
|
||||
|
||||
menu :label => 'Teachers', :parent => 'JamClass'
|
||||
menu :label => 'Teacher', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = true
|
||||
config.filters = false
|
||||
|
||||
scope("All", default: true) { |scope| scope.order("background_check_at > '#{(Date.today - 365).to_s}}' NULLS FIRST, teachers.ready_for_session_at IS NULL DESC") }
|
||||
scope("All Sorted By Sign Up") { |scope| scope.order("teachers.created_at DESC, background_check_at > '#{(Date.today - 365).to_s}}' NULLS FIRST, teachers.ready_for_session_at IS NULL DESC") }
|
||||
scope("50% and Session Ready") { |scope| scope.where('profile_pct >= ?', 50.0).where('teachers.ready_for_session_at IS NOT NULL').order("background_check_at > '#{(Date.today - 365).to_s}}' NULLS FIRST, teachers.ready_for_session_at IS NULL DESC") }
|
||||
scope("50% and Not Session Ready") { |scope| scope.where('profile_pct > ?', 50.0).where('teachers.ready_for_session_at IS NULL').order("background_check_at > '#{(Date.today - 365).to_s}}' NULLS FIRST, teachers.ready_for_session_at IS NULL DESC") }
|
||||
|
||||
controller do
|
||||
active_admin_config.includes.push :user
|
||||
end
|
||||
|
||||
filter :teacher_full_name_or_user_email_cont, label: 'Name', as: :string
|
||||
filter :user_phantom, label: 'Phantom ', as: :boolean, selected: 'false'
|
||||
|
||||
#filter :by_search_user_name, label: "Name", as: :string
|
||||
scope("All", default: true) { |scope| scope.unscoped.order("background_check_at > '#{(Date.today - 365).to_s}}' NULLS FIRST, ready_for_session_at IS NULL DESC") }
|
||||
scope("All Sorted By Sign Up") { |scope| scope.unscoped.order("teachers.created_at DESC, background_check_at > '#{(Date.today - 365).to_s}}' NULLS FIRST, ready_for_session_at IS NULL DESC") }
|
||||
scope("50% and Session Ready" ) { |scope| scope.unscoped.where('profile_pct >= ?', 50.0).where('ready_for_session_at IS NOT NULL').order("background_check_at > '#{(Date.today - 365).to_s}}' NULLS FIRST, ready_for_session_at IS NULL DESC") }
|
||||
scope("50% and Not Session Ready" ) { |scope| scope.unscoped.where('profile_pct > ?', 50.0).where('ready_for_session_at IS NULL').order("background_check_at > '#{(Date.today - 365).to_s}}' NULLS FIRST, ready_for_session_at IS NULL DESC") }
|
||||
|
||||
index do
|
||||
column "Name" do |teacher|
|
||||
|
|
@ -54,7 +45,7 @@ ActiveAdmin.register JamRuby::Teacher, :as => 'Teachers' do
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
=begin
|
||||
column "Background Check" do |teacher|
|
||||
div do
|
||||
if teacher.background_check_at
|
||||
|
|
@ -65,37 +56,31 @@ ActiveAdmin.register JamRuby::Teacher, :as => 'Teachers' do
|
|||
br
|
||||
end
|
||||
span do
|
||||
link_to(edit_admin_teacher_background_check_path(teacher.id)) do
|
||||
"update background check"
|
||||
link_to(mark_background_check_admin_teacher_path(teacher.id), {confirm: "Mark as background checked?"}) do
|
||||
"mark as checked"
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
span do
|
||||
'NO'
|
||||
''
|
||||
end
|
||||
span do
|
||||
br
|
||||
end
|
||||
span do
|
||||
link_to("update background check", edit_admin_teacher_background_check_path(teacher.id))
|
||||
link_to("mark as checked", mark_background_check_admin_teacher_path(teacher.id), {confirm: "Mark as background checked?"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
=end
|
||||
column "Session Ready" do |teacher|
|
||||
div do
|
||||
if teacher.ready_for_session_at
|
||||
span do
|
||||
'YES'
|
||||
end
|
||||
span do
|
||||
br
|
||||
end
|
||||
span do
|
||||
link_to("mark not checked", mark_not_session_ready_admin_teacher_path(teacher.id), {confirm: "Mark not ready for session??"})
|
||||
end
|
||||
else
|
||||
span do
|
||||
'NO'
|
||||
|
|
@ -165,25 +150,21 @@ ActiveAdmin.register JamRuby::Teacher, :as => 'Teachers' do
|
|||
br
|
||||
br
|
||||
div do
|
||||
h5 do
|
||||
"Completed Sections"
|
||||
end
|
||||
h5 do "Completed Sections" end
|
||||
teacher.pct_complete.each do |k, v|
|
||||
if k != :pct && v
|
||||
div do
|
||||
k
|
||||
k
|
||||
end
|
||||
end
|
||||
end
|
||||
br
|
||||
br
|
||||
h5 do
|
||||
"Uncompleted Sections"
|
||||
end
|
||||
h5 do "Uncompleted Sections" end
|
||||
teacher.pct_complete.each do |k, v|
|
||||
if k != :pct && !v
|
||||
div do
|
||||
k
|
||||
k
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -230,12 +211,6 @@ ActiveAdmin.register JamRuby::Teacher, :as => 'Teachers' do
|
|||
span do
|
||||
'YES'
|
||||
end
|
||||
span do
|
||||
br
|
||||
end
|
||||
span do
|
||||
link_to("mark not checked", mark_not_session_ready_admin_teacher_path(teacher.id), {confirm: "Mark not ready for session??"})
|
||||
end
|
||||
else
|
||||
span do
|
||||
'NO'
|
||||
|
|
@ -287,52 +262,6 @@ ActiveAdmin.register JamRuby::Teacher, :as => 'Teachers' do
|
|||
end
|
||||
end
|
||||
|
||||
row "Booking Prices" do |teacher|
|
||||
div do
|
||||
table = teacher.booking_price_table
|
||||
if table[:single].length == 0 and table[:monthly].length == 0
|
||||
'No Pricing'
|
||||
else
|
||||
if table[:single].length > 0
|
||||
div do
|
||||
span do
|
||||
'SINGLE'
|
||||
end
|
||||
span do
|
||||
br
|
||||
end
|
||||
table[:single].each do |single|
|
||||
span do
|
||||
"#{single[:minutes]} min = $#{'%.2f' % (single[:price]/100.0)}"
|
||||
end
|
||||
span do
|
||||
br
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if table[:monthly].length > 0
|
||||
div do
|
||||
span do
|
||||
'MONTHLY'
|
||||
end
|
||||
span do
|
||||
br
|
||||
end
|
||||
table[:monthly].each do |monthly|
|
||||
span do
|
||||
"#{monthly[:minutes]} min = $#{'%.2f' % (monthly[:price]/100.0)}"
|
||||
end
|
||||
span do
|
||||
br
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -347,11 +276,6 @@ ActiveAdmin.register JamRuby::Teacher, :as => 'Teachers' do
|
|||
redirect_to :back
|
||||
end
|
||||
|
||||
member_action :mark_not_session_ready, :method => :get do
|
||||
resource.mark_not_session_ready
|
||||
redirect_to :back
|
||||
end
|
||||
|
||||
member_action :mark_top, :method => :get do
|
||||
resource.mark_top_rated
|
||||
redirect_to :back
|
||||
|
|
|
|||
|
|
@ -1,102 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::TestDrivePackage, :as => 'TestDrivePackage' do
|
||||
|
||||
menu :label => 'Test Drive Packages', :parent => 'JamClass'
|
||||
|
||||
config.sort_order = 'created_at desc'
|
||||
config.batch_actions = false
|
||||
config.per_page = 100
|
||||
config.paginate = true
|
||||
config.filters = false
|
||||
|
||||
form :partial => 'form'
|
||||
|
||||
|
||||
controller do
|
||||
=begin
|
||||
def new
|
||||
test_drive_package = TestDrivePackage.new
|
||||
t = TestDrivePackageTeacher.new
|
||||
t.test_drive_package = test_drive_package
|
||||
test_drive_package.test_drive_package_teachers << t
|
||||
|
||||
t = TestDrivePackageTeacher.new
|
||||
t.test_drive_package = test_drive_package
|
||||
test_drive_package.test_drive_package_teachers << t
|
||||
|
||||
@test_drive_package = test_drive_package
|
||||
puts "OK #{test_drive_package.test_drive_package_teachers.length}"
|
||||
super
|
||||
end
|
||||
=end
|
||||
|
||||
|
||||
# def create
|
||||
# puts params.inspect
|
||||
# hash = params[:jam_ruby_test_drive_package]
|
||||
# package = TestDrivePackage.new
|
||||
# package.name = hash[:name]
|
||||
# package.package_type = hash[:package_type]
|
||||
# package.description = hash[:description]
|
||||
# if package.save
|
||||
# redirect_to admin_test_drive_package_path(package.id)
|
||||
# else
|
||||
# redirect_to admin_test_drive_packages_path, :notice => "Unable to create package. Error: #{package.errors.first[1][0]}"
|
||||
# end
|
||||
#end
|
||||
end
|
||||
index do
|
||||
|
||||
column "Package ID" do |package|
|
||||
link_to package.name, "#{APP_CONFIG.external_root_url}/landing/jamclass/students?utm-teachers=#{package.name}"
|
||||
end
|
||||
|
||||
column "Package Type" do |package|
|
||||
package.package_type
|
||||
end
|
||||
|
||||
column "Teachers" do |package|
|
||||
package.test_drive_package_teachers.each do |package_teacher|
|
||||
|
||||
span do
|
||||
teacher = package_teacher.user
|
||||
link_to "#{teacher.name} (#{teacher.email})", "#{Rails.application.config.external_root_url}/client#/profile/teacher/#{teacher.id}"
|
||||
end
|
||||
br
|
||||
end
|
||||
end
|
||||
|
||||
column "Detail" do |package|
|
||||
link_to "Detail", admin_test_drive_package_path(package.id)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
show do
|
||||
|
||||
attributes_table do
|
||||
row "Package ID" do |package|
|
||||
link_to package.name, "#{APP_CONFIG.external_root_url}/landing/jamclass/students?utm-teachers=#{package.name}"
|
||||
end
|
||||
|
||||
row "Package Type" do |package|
|
||||
package.package_type
|
||||
end
|
||||
|
||||
row "Teachers" do |package|
|
||||
package.test_drive_package_teachers.each do |package_teacher|
|
||||
|
||||
span do
|
||||
teacher = package_teacher.user
|
||||
link_to "#{teacher.name} (#{teacher.email})", "#{Rails.application.config.external_root_url}/client#/profile/teacher/#{teacher.id}"
|
||||
end
|
||||
br
|
||||
end
|
||||
end
|
||||
|
||||
row "Description" do |package|
|
||||
package.description
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -15,7 +15,7 @@ ActiveAdmin.register_page "Test Jobs" do
|
|||
|
||||
content do
|
||||
|
||||
active_admin_form_for LongRunning.new, :url => admin_test_jobs_long_running_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
semantic_form_for LongRunning.new, :url => admin_test_jobs_long_running_path, :builder => ActiveAdmin::FormBuilder do |f|
|
||||
f.inputs "Queue a long running job" do
|
||||
f.input :time
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::Teacher, :as => 'TeacherBackgroundCheck' do
|
||||
|
||||
|
||||
config.filters = false
|
||||
menu :label => 'Teacher Background Check', :parent => 'JamClass'
|
||||
|
||||
|
||||
|
||||
form do |f|
|
||||
f.inputs 'Set Background Check' do
|
||||
f.input :background_check_at, as: :date_select
|
||||
end
|
||||
f.actions
|
||||
end
|
||||
|
||||
|
||||
index do
|
||||
column "Actions" do |teacher|
|
||||
links = ''.html_safe
|
||||
links << link_to("View", resource_path(teacher), :class => "member_link view_link")
|
||||
links << link_to("Edit", edit_resource_path(teacher), :class => "member_link edit_link")
|
||||
links
|
||||
end
|
||||
|
||||
column 'User' do |oo|
|
||||
oo.user.email
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
ActiveAdmin.register_page "Latency Between Users" do
|
||||
menu parent: 'Users'
|
||||
|
||||
content :title => "Latency Between Users" do
|
||||
render 'admin/users/users_latency_form'
|
||||
end
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
ActiveAdmin.register_page "Latency Recommendation" do
|
||||
menu parent: 'Users'
|
||||
|
||||
content :title => "Latency Recommentation" do
|
||||
render 'admin/users/latency_recommendation_form'
|
||||
end
|
||||
end
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
ActiveAdmin.register JamRuby::User, :as => 'UserSource' do
|
||||
|
||||
menu :label => 'User Campaigns', :parent => 'Users'
|
||||
|
||||
config.sort_order = 'created_at DESC'
|
||||
config.batch_actions = false
|
||||
config.clear_action_items!
|
||||
config.filters = false
|
||||
config.per_page = 250
|
||||
|
||||
scope("Paid", default: true) { |scope| scope.unscoped.where(:origin_utm_medium => 'cpc').order('created_at desc') }
|
||||
scope("Inorganic Source") { |scope| scope.unscoped.where("origin_utm_source != 'organic' OR origin_utm_source IS NULL").order('created_at desc') }
|
||||
scope("Include Organic") { |scope| scope.unscoped.order('created_at desc') }
|
||||
|
||||
index do
|
||||
column "Email" do |user|
|
||||
user.email
|
||||
end
|
||||
column "Signup (CST)" do |user|
|
||||
user.created_at.in_time_zone("Central Time (US & Canada)")
|
||||
end
|
||||
column "UTM Source" do |user|
|
||||
user.origin_utm_source
|
||||
end
|
||||
column "UTM Medium" do |user|
|
||||
user.origin_utm_medium
|
||||
end
|
||||
column "UTM Campaign" do |user|
|
||||
user.origin_utm_campaign
|
||||
end
|
||||
column "UTM ID" do |user|
|
||||
user.origin_id
|
||||
end
|
||||
column "UTM Term" do |user|
|
||||
user.origin_term
|
||||
end
|
||||
column "UTM Content" do |user|
|
||||
user.origin_content
|
||||
end
|
||||
column "Referrer" do |user|
|
||||
user.origin_referrer
|
||||
end
|
||||
column "FB Click ID" do |user|
|
||||
user.facebook_click_id
|
||||
end
|
||||
column "FB Browser ID" do |user|
|
||||
user.facebook_browser_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1 +0,0 @@
|
|||
First Name,Last Name,Email Address,User Type,School ID,School Name,License Start Date,License End Date,Source
Student,Student,seth+student1@jamkazam.com,Student,school_a,School A,1/1/20,1/1/21,K12
Student,Expired,seth+student2@jamkazam.com,Student,school_a,School A,1/2/19,1/1/20,K12
Teacher,Teacher,seth+teacher1@jamkazam.com,Student Instructor,school_a,School A,1/1/20,1/1/21,K12
Platform,Instructor,seth+platform1@jamkazam.com,Platform Instructor,school_a,School A,1/1/20,1/2/21,K12
|
||||
|
|
|
@ -1,23 +1,14 @@
|
|||
//= require active_admin/base
|
||||
|
||||
//= require activeadmin_addons/all
|
||||
// //= require jquery-ui
|
||||
// //= require active_admin/base
|
||||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
//= require jquery-ui
|
||||
// require jquery.ui.core
|
||||
// require jquery.ui.widget
|
||||
// require jquery.ui.datepicker
|
||||
// require jquery.ui.dialog
|
||||
// require jquery.ui.autocomplete
|
||||
//= require cocoon
|
||||
//= require active_admin/base
|
||||
//= require active_admin/searchable_select
|
||||
// //= require autocomplete-rails
|
||||
//= require active_admin/application
|
||||
//= require autocomplete-rails
|
||||
//= require base
|
||||
//= require_tree .
|
||||
//= require best_in_place.jquery-ui
|
||||
|
||||
$(document).ready(function() {
|
||||
jQuery(".best_in_place").best_in_place();
|
||||
$.datepicker.setDefaults({
|
||||
dateFormat: 'yy-mm-dd',
|
||||
});
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
#= require active_admin/base
|
||||
#= require jquery3
|
||||
#= require best_in_place
|
||||
#= require jquery.purr
|
||||
#= require best_in_place.purr
|
||||
|
||||
$(document).ready ->
|
||||
# IS NOT HAPPENING: USE ACTIVE_ADMIN.JS
|
||||
console.log("DAT COFFEE INIT")
|
||||
jQuery(".best_in_place").best_in_place()
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
$(document).ready(function() {
|
||||
jQuery(".ac_bip").bind("ajax:success", function(){ window.location.reload(); });
|
||||
})
|
||||
|
|
@ -10,3 +10,5 @@
|
|||
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
||||
// GO AFTER THE REQUIRES BELOW.
|
||||
//
|
||||
//= require jquery
|
||||
//= require jquery_ujs
|
||||
|
|
|
|||
|
|
@ -1,110 +0,0 @@
|
|||
function intToIP(int) {
|
||||
var part1 = int & 255;
|
||||
var part2 = ((int >> 8) & 255);
|
||||
var part3 = ((int >> 16) & 255);
|
||||
var part4 = ((int >> 24) & 255);
|
||||
|
||||
return part4 + "." + part3 + "." + part2 + "." + part1;
|
||||
}
|
||||
|
||||
function handleJamTrackRightsForm() {
|
||||
var $jamTrackRights = $('form#new_jam_ruby_jam_track_right');
|
||||
var $jamTrack = $jamTrackRights.find('#jam_ruby_jam_track_right_jam_track_id');
|
||||
var $jamTrackVal = $jamTrackRights.find('#jam_ruby_jam_track_right_jam_track_id_val')
|
||||
|
||||
var $user = $jamTrackRights.find('#jam_ruby_jam_track_right_user_id');
|
||||
var $userVal = $jamTrackRights.find('#jam_ruby_jam_track_right_user_id_val');
|
||||
$jamTrack.on('change', function(){
|
||||
console.log("change jam track");
|
||||
});
|
||||
|
||||
/**
|
||||
$user.on('change', function(){
|
||||
console.log("change user");
|
||||
});
|
||||
|
||||
$jamTrack.on('focus', function(){
|
||||
$userVal.val('')
|
||||
});*/
|
||||
|
||||
$jamTrack.bind('railsAutocomplete.select', function(event, data){
|
||||
$jamTrackVal.val('');
|
||||
$jamTrackVal.val(data.item.id);
|
||||
console.log("jam track selected with id " + data.item.id);
|
||||
});
|
||||
|
||||
$user.bind('railsAutocomplete.select', function(event, data){
|
||||
$userVal.val('');
|
||||
$userVal.val(data.item.id);
|
||||
console.log("user selected with id " + data.item.id);
|
||||
});
|
||||
}
|
||||
function handleUserLatencyForm(){
|
||||
var $userLatenciesForm = $('form#user_latencies_form');
|
||||
var $latenciesMyUser = $userLatenciesForm.find('#latencies_my_user');
|
||||
var $latenciesMyUserId = $userLatenciesForm.find('#latencies_my_user_id');
|
||||
var $latenciesMyPublicIp = $userLatenciesForm.find('#latencies_my_public_ip');
|
||||
|
||||
$latenciesMyUser.on('focus', function(){
|
||||
$latenciesMyUserId.val('')
|
||||
});
|
||||
|
||||
$latenciesMyUser.bind('railsAutocomplete.select', function(event, data){
|
||||
$latenciesMyUserId.val('');
|
||||
$latenciesMyPublicIp.val('');
|
||||
if(data.item.last_jam_addr){
|
||||
var ipAddr = intToIP(data.item.last_jam_addr);
|
||||
$latenciesMyPublicIp.val(ipAddr);
|
||||
}
|
||||
$latenciesMyUserId.val(data.item.id);
|
||||
});
|
||||
|
||||
$userLatenciesForm.find('#latencies_user_1').bind('railsAutocomplete.select', function(event, data){
|
||||
$userLatenciesForm.find('#latencies_user_1_id').val(data.item.id);
|
||||
});
|
||||
|
||||
$userLatenciesForm.find('#latencies_user_2').bind('railsAutocomplete.select', function(event, data){
|
||||
$userLatenciesForm.find('#latencies_user_2_id').val(data.item.id);
|
||||
});
|
||||
|
||||
$userLatenciesForm.find('#latencies_user_3').bind('railsAutocomplete.select', function(event, data){
|
||||
$userLatenciesForm.find('#latencies_user_3_id').val(data.item.id);
|
||||
});
|
||||
|
||||
$userLatenciesForm.find('#latencies_user_4').bind('railsAutocomplete.select', function(event, data){
|
||||
$userLatenciesForm.find('#latencies_user_4_id').val(data.item.id);
|
||||
});
|
||||
|
||||
$userLatenciesForm.find('#latencies_user_5').bind('railsAutocomplete.select', function(event, data){
|
||||
$userLatenciesForm.find('#latencies_user_5_id').val(data.item.id);
|
||||
});
|
||||
}
|
||||
|
||||
function handleLatencyRecommendationForm(){
|
||||
var $latencyRecommendationForm = $('form#latency_recommendation_form');
|
||||
var $latenciesMyUser = $latencyRecommendationForm.find('#latency_recommendation_my_user');
|
||||
var $latenciesMyUserId = $latencyRecommendationForm.find('#latency_recommendation_my_user_id');
|
||||
var $latenciesMyPublicIp = $latencyRecommendationForm.find('#latency_recommendation_my_public_ip');
|
||||
|
||||
$latenciesMyUser.on('focus', function(){
|
||||
$latenciesMyUserId.val('')
|
||||
});
|
||||
|
||||
$latenciesMyUser.bind('railsAutocomplete.select', function(event, data){
|
||||
$latenciesMyUserId.val('');
|
||||
$latenciesMyPublicIp.val('');
|
||||
if(data.item.last_jam_addr){
|
||||
var ipAddr = intToIP(data.item.last_jam_addr);
|
||||
$latenciesMyPublicIp.val(ipAddr);
|
||||
}
|
||||
$latenciesMyUserId.val(data.item.id);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
handleUserLatencyForm();
|
||||
handleLatencyRecommendationForm();
|
||||
handleJamTrackRightsForm();
|
||||
});
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
//= require activeadmin_addons/all
|
||||
// SASS variable overrides must be declared before loading up Active Admin's styles.
|
||||
//
|
||||
// To view the variables that Active Admin provides, take a look at
|
||||
|
|
@ -9,13 +8,12 @@
|
|||
// $sidebar-width: 242px;
|
||||
|
||||
/*
|
||||
*= require jquery-ui
|
||||
*= require jquery.ui.all
|
||||
*= require custom
|
||||
*/
|
||||
// Active Admin's got SASS!
|
||||
@import "active_admin/mixins";
|
||||
@import "active_admin/base";
|
||||
@import "active_admin/searchable_select";
|
||||
|
||||
// Overriding any non-variable SASS must be done after the fact.
|
||||
// For example, to change the default status-tag color:
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
// SASS variable overrides must be declared before loading up Active Admin's styles.
|
||||
//
|
||||
// To view the variables that Active Admin provides, take a look at
|
||||
// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
|
||||
// Active Admin source.
|
||||
//
|
||||
// For example, to change the sidebar width:
|
||||
// $sidebar-width: 242px;
|
||||
|
||||
// Active Admin's got SASS!
|
||||
@import "active_admin/mixins";
|
||||
@import "active_admin/base";
|
||||
|
||||
// Overriding any non-variable SASS must be done after the fact.
|
||||
// For example, to change the default status-tag color:
|
||||
//
|
||||
// .status_tag { background: #6090DB; }
|
||||
|
|
@ -9,6 +9,6 @@
|
|||
* compiled file, but it's generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_self
|
||||
*= require jquery-ui
|
||||
*= require jquery.ui.all
|
||||
*= require_tree .
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -29,16 +29,4 @@
|
|||
background-color:white;
|
||||
border:1px solid gray;
|
||||
padding:5px;
|
||||
}
|
||||
.datetime_select li.fragment {
|
||||
|
||||
|
||||
label {
|
||||
display: block;
|
||||
width:auto;
|
||||
}
|
||||
}
|
||||
|
||||
.admin_subscription_cohorts #main_content td.col{
|
||||
font-family:Courier;
|
||||
}
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
class ArsesController < ApplicationController
|
||||
|
||||
respond_to :json
|
||||
|
||||
def index
|
||||
if params[:code] != Rails.application.config.data_dump_code
|
||||
render :json => {error: "Unauthorized"}, :status => 401
|
||||
return
|
||||
end
|
||||
|
||||
@arses = JamRuby::Ars.all
|
||||
render :json => @arses
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:code] != Rails.application.config.data_dump_code
|
||||
render :json => {error: "Unauthorized"}, :status => 401
|
||||
return
|
||||
end
|
||||
|
||||
begin
|
||||
# Primary ID lookup
|
||||
@ars = JamRuby::Ars.find_by_id(params[:id])
|
||||
|
||||
# Explicit secondary lookups if primary ID fails
|
||||
@ars ||= JamRuby::Ars.find_by_id_int(params[:id_int]) if params[:id_int]
|
||||
@ars ||= JamRuby::Ars.find_by_name(params[:name]) if params[:name]
|
||||
|
||||
if @ars.nil?
|
||||
render :json => {error: "Not Found"}, :status => 404
|
||||
return
|
||||
end
|
||||
|
||||
allowed = [:password, :username, :active, :beta, :name, :provider, :id_int, :ip, :port, :continent, :country, :city, :subdivision, :latitude, :longitude]
|
||||
|
||||
update_hash = {}
|
||||
allowed.each do |attr|
|
||||
update_hash[attr] = params[attr] if params.has_key?(attr)
|
||||
end
|
||||
|
||||
if @ars.update_attributes(update_hash, as: :admin)
|
||||
render :json => @ars, :status => :ok
|
||||
else
|
||||
render :json => @ars.errors, :status => :unprocessable_entity
|
||||
end
|
||||
rescue => e
|
||||
render :json => {error: e.message, backtrace: e.backtrace.first(5)}, :status => 500
|
||||
end
|
||||
end
|
||||
|
||||
# create or update a client_artifact row
|
||||
def get_or_create
|
||||
begin
|
||||
name = params[:name]
|
||||
provider = params[:provider]
|
||||
active = params[:active]
|
||||
beta = params.has_key?(:beta) ? params[:beta] : true
|
||||
ip = params[:ip]
|
||||
username = params[:username]
|
||||
password = params[:password]
|
||||
topology = params[:topology]
|
||||
ars_id = params[:ars_id]
|
||||
|
||||
# Explicit field-based lookups
|
||||
ars = nil
|
||||
ars = JamRuby::Ars.find_by_id_int(ars_id) if ars_id
|
||||
ars ||= JamRuby::Ars.find_by_name(name) if name
|
||||
|
||||
if ars.nil?
|
||||
ars = JamRuby::Ars.new
|
||||
ars.name = name
|
||||
end
|
||||
|
||||
ars.id_int = ars_id if !ars_id.nil?
|
||||
ars.provider = provider
|
||||
ars.active = active
|
||||
ars.beta = params[:beta]
|
||||
ars.beta = beta
|
||||
ars.ip = ip
|
||||
ars.password = password
|
||||
ars.username = username
|
||||
if topology
|
||||
ars.city = topology['city']
|
||||
ars.country = topology['country']
|
||||
ars.continent = topology['continent']
|
||||
ars.latitude = topology['latitude']
|
||||
ars.longitude = topology['longitude']
|
||||
ars.subdivision = topology['subdivision']
|
||||
end
|
||||
ars.save!
|
||||
|
||||
@ars = ars
|
||||
render :json => {id_int: @ars.id_int, id: @ars.id, name: @ars.name, provider: @ars.provider, active: @ars.active, beta: @ars.beta, ip: @ars.ip}, :status => :ok
|
||||
rescue => e
|
||||
render :json => {error: e.message, backtrace: e.backtrace.first(5)}, :status => 500
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -14,7 +14,7 @@ class ArtifactsController < ApplicationController
|
|||
ArtifactUpdate.transaction do
|
||||
# VRFS-1071: Postpone client update notification until installer is available for download
|
||||
ArtifactUpdate.connection.execute('SET TRANSACTION ISOLATION LEVEL READ COMMITTED')
|
||||
@artifact = ArtifactUpdate.find_or_create_by({product: product, environment: environment})
|
||||
@artifact = ArtifactUpdate.find_or_create_by_product_and_environment(product, environment)
|
||||
|
||||
@artifact.version = version
|
||||
@artifact.uri = file
|
||||
|
|
@ -26,12 +26,12 @@ class ArtifactsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
unless @artifact.errors.any?
|
||||
render :json => {}, :status => :ok
|
||||
else
|
||||
response.status = :unprocessable_entity
|
||||
respond_with @artifact
|
||||
end
|
||||
unless @artifact.errors.any?
|
||||
render :json => {}, :status => :ok
|
||||
else
|
||||
response.status = :unprocessable_entity
|
||||
respond_with @artifact
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
module ActiveAdmin
|
||||
module SubscriptionHelper
|
||||
def subscription_plan_name(code)
|
||||
case code
|
||||
when 'jamrubysilver'
|
||||
'Silver'
|
||||
when 'jamrubygold'
|
||||
'Gold'
|
||||
when 'jamrubyplatinum'
|
||||
'Platinum'
|
||||
when 'jamsubgoldyearly'
|
||||
'Gold Yearly'
|
||||
when 'jamsubsilveryearly'
|
||||
'Silver Yearly'
|
||||
when 'jamsubplatinumyearly'
|
||||
'Platinum Yearly'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,42 +1,5 @@
|
|||
module ApplicationHelper
|
||||
|
||||
|
||||
def parse_user_type(user_type, options)
|
||||
if user_type == 'Student'
|
||||
options[:student] = true
|
||||
elsif user_type == 'Student Instructor'
|
||||
options[:teacher] = true
|
||||
elsif user_type == 'Platform Instructor'
|
||||
options[:platform_instructor] = true
|
||||
else
|
||||
raise JamRuby::JamPermissionError, "Unknown user type #{user_type}"
|
||||
end
|
||||
end
|
||||
|
||||
def parse_date(date)
|
||||
delimiter = '/'
|
||||
bits = date.split(delimiter)
|
||||
|
||||
if bits.length != 3
|
||||
delimiter = '-'
|
||||
bits = date.split(delimiter)
|
||||
end
|
||||
|
||||
if bits.length != 3
|
||||
raise JamRuby::JamPermissionError, "date #{date} has no '-' or '/'"
|
||||
end
|
||||
|
||||
if bits[2].length == 4 || (bits[0].length != 4 && bits[2].to_i > 12) # excel likes to do 1/1/20. So if last
|
||||
if bits[2].length == 2
|
||||
# prepend year
|
||||
|
||||
date = [bits[0], bits[1], '20' + bits[2]].join(delimiter)
|
||||
end
|
||||
Date.strptime(date, "%m#{delimiter}%d#{delimiter}%Y")
|
||||
else
|
||||
Date.strptime(date, "%Y#{delimiter}%m#{delimiter}%d")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,3 +1,2 @@
|
|||
module JamSessionsHelper
|
||||
|
||||
end
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
class JsonInput < Formtastic::Inputs::StringInput
|
||||
end
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
module MetaHelper
|
||||
|
||||
def version()
|
||||
"web=#{::JamAdmin::VERSION} lib=#{JamRuby::VERSION}"
|
||||
"web=#{::JamAdmin::VERSION} lib=#{JamRuby::VERSION} db=#{JamDb::VERSION}"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Cohort < ActiveRecord::Base
|
|||
}
|
||||
|
||||
attr_accessible :all_time, :monthly_start
|
||||
#serialize :data_set, JSON
|
||||
serialize :data_set, JSON
|
||||
|
||||
before_create do
|
||||
self.data_set ||= {}
|
||||
|
|
@ -112,19 +112,6 @@ class Cohort < ActiveRecord::Base
|
|||
def self.cohort_users(cohort)
|
||||
User.where(created_at: cohort.group_start..cohort.group_end)
|
||||
end
|
||||
=begin
|
||||
SELECT played.user_id FROM
|
||||
(SELECT user_id, COUNT(*) cnt FROM music_sessions_user_history msuh1
|
||||
WHERE
|
||||
msuh1.created_at >= '2024-11-01' AND
|
||||
msuh1.created_at <= '202' AND
|
||||
EXTRACT(EPOCH FROM (msuh1.session_removed_at - msuh1.created_at)) >= 900 AND
|
||||
(SELECT COUNT(*) FROM music_sessions_user_history msuh2
|
||||
WHERE msuh1.music_session_id = msuh2.music_session_id
|
||||
) > 1
|
||||
GROUP BY user_id
|
||||
) played
|
||||
=end
|
||||
|
||||
def _played_online_subquery(constraint)
|
||||
where = if constraint.is_a?(Range)
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
<%= label_tag :customer_ltv, 'Customer LTV : $' %>
|
||||
<%= best_in_place GenericState.singleton, :customer_ltv, :as => :input, url: "#{ENV['RAILS_RELATIVE_URL_ROOT']}/admin/generic_states/#{GenericState.singleton.id}", place_holder: "---", :ok_button => 'Save', :cancel_button => 'Cancel', classes: 'ac_bip' %>
|
||||
<br />
|
||||
<br />
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
<h3>Earnings by Month</h3>
|
||||
<table class="index_table index">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Month</th>
|
||||
<th>JamTracks</th>
|
||||
<th>Subscriptions</th>
|
||||
<th>Affiliate Earnings</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% AffiliateMonthlyPayment.index(affiliate_partner.partner_user, {})[0].each do |payment| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%= Date::MONTHNAMES[payment.month] if payment.month %>
|
||||
<%= payment.year %>
|
||||
</td>
|
||||
<td>
|
||||
<% if payment.jamtracks_sold > 0 %>
|
||||
JamTracks: <%= pluralize payment.jamtracks_sold, 'unit' %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td>
|
||||
<%
|
||||
month_start = Date.new(payment.year, payment.month, 1)
|
||||
month_end = Date.new(payment.year, payment.month, 1).end_of_month
|
||||
AffiliateDistribution.subscription_plans_count(affiliate_partner.id, month_start, month_end).each do |plan_count|
|
||||
%>
|
||||
<div>
|
||||
<%= subscription_plan_name(plan_count[:plan]) -%>: <%= pluralize(plan_count.count, 'unit') -%> sold
|
||||
</div>
|
||||
<%
|
||||
end
|
||||
%>
|
||||
</td>
|
||||
<td>
|
||||
<%= number_to_currency(payment.due_amount_in_cents.to_f/100.0) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
<%= f.semantic_errors *f.object.errors.keys %>
|
||||
<%= f.inputs do %>
|
||||
<%= f.input(:partner_name, :input_html => {:maxlength => 128}) %>
|
||||
<%= f.input(:partner_user, as: :searchable_select, ajax: true, hint: 'The user that manages/owns this affiliate. They can see affiliate reports') %>
|
||||
<%= f.input(:entity_type, :as => :select, :collection => AffiliatePartner::ENTITY_TYPES) %>
|
||||
<%= f.input(:rate) %>
|
||||
<% end %>
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue