atomic_admin 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a60af477fc58d9334de687508e1eb0ef56f2bef8ec96e5fabd726133e0934b2
|
|
4
|
+
data.tar.gz: f17e627608ebc01b5b9281cff0af01ebf17d10d06cd4db62744d833fc4b790e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ca007af30664fd22c363cff5a2e76b8bf818928d9100a9b43af07dcf1ac18a93034d0ec3f89107226ac9e1755e0ec055167f0680d607b0f4bc0eadbeaaa96fb
|
|
7
|
+
data.tar.gz: f15c1ea152ef5869f3465a1a47bb36dfa7685808cffad13989c42b34d1e8368a984116cf00d5d703202ee4c671a73bd80afbe4fd526a1925b4b78cc57e5237c3
|
|
@@ -15,6 +15,7 @@ module AtomicAdmin::V1
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
@application_instances, meta = filter(@application_instances)
|
|
18
|
+
@stats = get_stats_for_instances(@application_instances)
|
|
18
19
|
|
|
19
20
|
render json: {
|
|
20
21
|
application_instances: json_for_collection(@application_instances),
|
|
@@ -24,12 +25,14 @@ module AtomicAdmin::V1
|
|
|
24
25
|
|
|
25
26
|
def show
|
|
26
27
|
@application_instance = ApplicationInstance.find(params[:id])
|
|
28
|
+
@stats = get_stats_for_instances([@application_instance])
|
|
27
29
|
render json: { application_instance: json_for(@application_instance) }
|
|
28
30
|
end
|
|
29
31
|
|
|
30
32
|
def create
|
|
31
33
|
application = Application.find(params[:application_id])
|
|
32
34
|
instance = application.application_instances.new(create_params)
|
|
35
|
+
@stats = get_stats_for_instances([instance])
|
|
33
36
|
|
|
34
37
|
if instance.save
|
|
35
38
|
render json: { application_instance: json_for(instance) }
|
|
@@ -41,6 +44,7 @@ module AtomicAdmin::V1
|
|
|
41
44
|
def update
|
|
42
45
|
instance = ApplicationInstance.find(params[:id])
|
|
43
46
|
instance.update(update_params)
|
|
47
|
+
@stats = get_stats_for_instances([instance])
|
|
44
48
|
|
|
45
49
|
if params[:application_instance][:is_paid] && instance.paid_at.nil?
|
|
46
50
|
instance.paid_at = DateTime.now
|
|
@@ -67,6 +71,27 @@ module AtomicAdmin::V1
|
|
|
67
71
|
render json: { interactions: interactions }
|
|
68
72
|
end
|
|
69
73
|
|
|
74
|
+
def get_stats_for_instances(instances)
|
|
75
|
+
tenants = instances.pluck(:tenant)
|
|
76
|
+
stats = {}
|
|
77
|
+
stats[:errors] = RequestStatistic.total_errors_grouped(tenants) if defined?(RequestStatistic)
|
|
78
|
+
stats[:unique_users] = CachedUniqueUsersByContractDate.unique_users_by_contract_date(instances) if defined?(CachedUniqueUsersByContractDate)
|
|
79
|
+
stats[:max_users_month] = CachedUniqueUsersByMonth.max_monthly_unique_users(instances) if defined?(CachedUniqueUsersByMonth)
|
|
80
|
+
|
|
81
|
+
stats
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def request_stats(instance)
|
|
85
|
+
tenant = instance.tenant
|
|
86
|
+
|
|
87
|
+
{
|
|
88
|
+
unique_users_in_contract: @stats.dig(:unique_users, tenant) || 0,
|
|
89
|
+
day_1_errors: @stats.dig(:errors, 0, tenant) || 0,
|
|
90
|
+
day_7_errors: @stats.dig(:errors, 7, tenant) || 0,
|
|
91
|
+
max_users_month: @stats.dig(:max_users_month, tenant) || 0,
|
|
92
|
+
}
|
|
93
|
+
end
|
|
94
|
+
|
|
70
95
|
def json_for(instance)
|
|
71
96
|
json = instance.as_json(include: [:application, :site])
|
|
72
97
|
|
|
@@ -74,8 +99,10 @@ module AtomicAdmin::V1
|
|
|
74
99
|
json["trial_end_date"] = instance.trial_end_date&.strftime("%Y-%m-%d") if instance.respond_to?(:trial_end_date)
|
|
75
100
|
json["license_start_date"] = instance.license_start_date&.strftime("%Y-%m-%d") if instance.respond_to?(:license_start_date)
|
|
76
101
|
json["license_end_date"] = instance.license_end_date&.strftime("%Y-%m-%d") if instance.respond_to?(:license_end_date)
|
|
102
|
+
json["paid_at"] = instance.paid_at&.strftime("%Y-%m-%d") if instance.respond_to?(:paid_at)
|
|
77
103
|
json["is_paid"] = instance.paid_at.present? if instance.respond_to?(:paid_at)
|
|
78
104
|
json["lti_config_xml"] = instance.lti_config_xml if instance.respond_to?(:lti_config_xml)
|
|
105
|
+
json["request_stats"] = request_stats(instance)
|
|
79
106
|
|
|
80
107
|
json
|
|
81
108
|
end
|
|
@@ -10,7 +10,7 @@ module AtomicAdmin::Schema
|
|
|
10
10
|
type: "boolean",
|
|
11
11
|
title: "Paid Account"
|
|
12
12
|
},
|
|
13
|
-
|
|
13
|
+
paid_at: {
|
|
14
14
|
type: ["string", "null"],
|
|
15
15
|
format: "date",
|
|
16
16
|
},
|
|
@@ -57,10 +57,12 @@ module AtomicAdmin::Schema
|
|
|
57
57
|
{
|
|
58
58
|
type: "Control",
|
|
59
59
|
scope: "#/properties/is_paid",
|
|
60
|
+
|
|
60
61
|
},
|
|
61
62
|
{
|
|
62
63
|
type: "Control",
|
|
63
|
-
scope: "#/properties/
|
|
64
|
+
scope: "#/properties/paid_at",
|
|
65
|
+
label: "License Start Date",
|
|
64
66
|
options: {
|
|
65
67
|
format: "date",
|
|
66
68
|
},
|
data/lib/atomic_admin/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: atomic_admin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nick Benoit
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-06-
|
|
12
|
+
date: 2026-06-16 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|
|
@@ -31,6 +31,66 @@ dependencies:
|
|
|
31
31
|
- - "<"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '9.0'
|
|
34
|
+
- !ruby/object:Gem::Dependency
|
|
35
|
+
name: atomic_lti
|
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 1.5.0
|
|
41
|
+
- - "<"
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: 5.0.0
|
|
44
|
+
type: :runtime
|
|
45
|
+
prerelease: false
|
|
46
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: 1.5.0
|
|
51
|
+
- - "<"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 5.0.0
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: atomic_tenant
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 1.2.0
|
|
61
|
+
- - "<"
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: 2.0.0
|
|
64
|
+
type: :runtime
|
|
65
|
+
prerelease: false
|
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
67
|
+
requirements:
|
|
68
|
+
- - ">="
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: 1.2.0
|
|
71
|
+
- - "<"
|
|
72
|
+
- !ruby/object:Gem::Version
|
|
73
|
+
version: 2.0.0
|
|
74
|
+
- !ruby/object:Gem::Dependency
|
|
75
|
+
name: httparty
|
|
76
|
+
requirement: !ruby/object:Gem::Requirement
|
|
77
|
+
requirements:
|
|
78
|
+
- - ">="
|
|
79
|
+
- !ruby/object:Gem::Version
|
|
80
|
+
version: 0.24.0
|
|
81
|
+
- - "<"
|
|
82
|
+
- !ruby/object:Gem::Version
|
|
83
|
+
version: 1.0.0
|
|
84
|
+
type: :runtime
|
|
85
|
+
prerelease: false
|
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
87
|
+
requirements:
|
|
88
|
+
- - ">="
|
|
89
|
+
- !ruby/object:Gem::Version
|
|
90
|
+
version: 0.24.0
|
|
91
|
+
- - "<"
|
|
92
|
+
- !ruby/object:Gem::Version
|
|
93
|
+
version: 1.0.0
|
|
34
94
|
description: Engine to provide apis that power the Atomic Jolt admin app
|
|
35
95
|
email:
|
|
36
96
|
- nick.benoit@atomicjolt.com
|