app_manager 1.4.1 → 1.4.2

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: 8c08b2b7330d0590d3de81bd25db16817ddca044984dd3761be00d073ff92b85
4
- data.tar.gz: eea3b459b131b5da995ed2b067fae91fe2499b03f14f4cf3f286d856986ee868
3
+ metadata.gz: d468cb1d631b3dd1d1ba0e8f76e40325c016b829c647c96d94ed0de4c61fe695
4
+ data.tar.gz: ec9a70baaa08bf3ccaebb45dde27e4f5dde7daf72fafe6c79c3ac158e9c649fe
5
5
  SHA512:
6
- metadata.gz: 4d5092dd2ccab3b389eda6f93bb826c66a41f8a6508e8a926d9ebc018b073cf732cbd7b400eb7fde0a6b30bce632651891d93207a2cbdb52c35965ae3ce443d5
7
- data.tar.gz: d6d93a43535968f4135a8704988b09091b5e2880a534dcb4f8b171a71388d564a782d1911139528782ad0ef536920f1a8be295adef77522105e5f5e3aff1a2cd
6
+ metadata.gz: 7215b1509241685ed730efaa6c19d291f653e5bc06f24599bd37610512a54ce854b24f4e0a7c82be31638d404f11e57f7bd13cf3b6b97084781cd29741658cce
7
+ data.tar.gz: 3f08b7e25236d1aee6fb8a5488fc8f07545bcfb388865d352b7d83c65a55470b4b8397a2fed24f795b8c7b94fec92c7ce5632aa4eb5ea5224818a342c46772c0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_manager (1.4.1)
4
+ app_manager (1.4.2)
5
5
  activerecord-import (~> 1.4)
6
6
  httparty
7
7
  kaminari (>= 0.16.3)
@@ -63,7 +63,7 @@ GEM
63
63
  activerecord (7.0.4)
64
64
  activemodel (= 7.0.4)
65
65
  activesupport (= 7.0.4)
66
- activerecord-import (1.4.0)
66
+ activerecord-import (1.4.1)
67
67
  activerecord (>= 4.2)
68
68
  activestorage (7.0.4)
69
69
  actionpack (= 7.0.4)
@@ -86,7 +86,7 @@ module AppManager
86
86
  plans = plans.values if !plans.nil?
87
87
  shopify_plans = params[:shopify_plans] || nil
88
88
  shopify_plans = shopify_plans.values if !shopify_plans.nil?
89
- items_per_page = 25
89
+ items_per_page = params[:itemsPerPage] || 25
90
90
  @shopify_email = AppManager.configuration.field_names['shopify_email']
91
91
  @shopify_plan_name_field = AppManager.configuration.field_names['shopify_plan']
92
92
  if params[:search]
@@ -100,20 +100,21 @@ module AppManager
100
100
  data = data.where(@shopify_plan_name_field => shopify_plans) if !shopify_plans.nil?
101
101
  data = data.page(params[:page]).per(items_per_page)
102
102
  end
103
+ all_user_count = model.count
103
104
  users = {
104
105
  "current_page" => data && data.current_page ? data.current_page : 0,
105
106
  "data" => data ? data.collect { |st| @field_names.map { |key, value| [key, "#{st[value]}"] }.to_h } : [],
106
107
  "first_page_url" => "#{app_url}/api/app-manager/users?page=1",
107
- "from" => data && data.total_pages ? 1 : 0,
108
+ "from" => data && data.total_pages ? data.current_page == 1 ? 1 : ((data.current_page-1)*items_per_page)+1 : 0,
108
109
  "last_page" => data && data.total_pages ? data.total_pages : 0,
109
110
  "last_page_url" => data && data.total_pages ? "#{app_url}/api/app-manager/users?page=#{data.total_pages}" : nil,
110
111
  "links" => '',
111
112
  "next_page_url" => data && data.next_page ? "#{app_url}/api/app-manager/users?page=#{data.next_page}" : nil,
112
113
  "path" => "#{app_url}/api/app-manager/users",
113
- "per_page" => 1,
114
+ "per_page" => items_per_page,
114
115
  "prev_page_url" => data && data.prev_page ? "#{app_url}/api/app-manager/users?page=#{data.prev_page}" : nil,
115
- "to" => data && data.total_pages ? data.total_pages : 0,
116
- "total" => data && data.total_pages ? data.total_pages : 0,
116
+ "to" => data && data.total_pages ? data.current_page == data.total_pages ? all_user_count : ((data && data.current_page ? data.current_page : 0)*data.size) : 0,
117
+ "total" => all_user_count,
117
118
  }
118
119
  render json: users
119
120
 
@@ -128,8 +128,8 @@ module AppManager
128
128
  #Complete
129
129
  def save_api_app_structures(app_structures)
130
130
  begin
131
- # ActiveRecord::Base.establish_connection(:app_manager).connection.execute("TRUNCATE app_structures RESTART IDENTITY")
132
- AppManager::AppStructure.connection.truncate(AppManager::AppStructure.table_name)
131
+ ActiveRecord::Base.establish_connection(:app_manager).connection.execute("TRUNCATE app_structures RESTART IDENTITY")
132
+ # AppManager::AppStructure.connection.truncate(AppManager::AppStructure.table_name)
133
133
  rescue
134
134
  AppManager::AppStructure.delete_all
135
135
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppManager
4
- VERSION = "1.4.1"
4
+ VERSION = "1.4.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hulkapps
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-07 00:00:00.000000000 Z
11
+ date: 2022-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty