usps-support 0.1.16 → 0.1.18

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: a3004655fc0ad62bfa6576b333df7704ae4017729e57ec6af48e1588331928a2
4
- data.tar.gz: 750225d963d7fff7416d06144fe9ed0b910c3c4fd8b571fb18bc2664c48d7cb4
3
+ metadata.gz: a4d02290f42c18db7ea799b7a3114a7a7567d49d28c14bf6f19eada7df177c1d
4
+ data.tar.gz: 8b745e3a2d51043f1fc15da7936978b4df958c0bfdd54b4982f5977201153758
5
5
  SHA512:
6
- metadata.gz: 4c24d2914dd079845272284ab644d2f7ab46cb9e5f6ab5059f68d51a4b9c7748a138b961e7677cbfcfe321c581ce52fc0e2ad53d38be983089905ff0895df167
7
- data.tar.gz: abe16dcce7e2b7cdf1c80f5ddfce91f3f7410bd16b3fe6246f83d3163d8a1e61b22f911d221f01f2bd214fc085fa7be01314cb1978ec6c8b7840a64941339d54
6
+ metadata.gz: c6c80ef6cf1b054408ca16e043d3d9ed8080b681906e0ea910e13e7d1f66f4b8fb3578154f4268e29acd45d4e84d06a3306249506324e59f58b1abd17f2735a6
7
+ data.tar.gz: 720b3fb9491098ee8968681b43dfe3bf8d1bf320afd52ab4d21f0706c74b2357cf417df2d72e534c6acfd5824cd41a6fc23c6c8a2e8b09ffef447fc54a21fceb
@@ -0,0 +1,198 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # This file is the source Rails uses to define your schema when running `bin/rails
6
+ # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema[7.2].define(version: 2025_11_01_000000) do
14
+ create_table "abftp2", primary_key: "certificate", id: { type: :string, limit: 7 }, charset: "latin1", comment: "dtb-for PM created daily from HQ-has X members", force: :cascade do |t|
15
+ t.integer "district", default: 0, null: false
16
+ t.integer "sqdno", default: 0, null: false
17
+ t.string "account", limit: 5, null: false
18
+ t.string "password", limit: 10, null: false
19
+ t.string "sqdname", limit: 30, null: false
20
+ t.integer "month", default: 0, null: false
21
+ t.string "firstname", limit: 15
22
+ t.string "lastname", limit: 25
23
+ t.string "areacode", limit: 3
24
+ t.string "telephone", limit: 10
25
+ t.string "status", limit: 30, null: false, collation: "latin1_bin"
26
+ t.string "type", limit: 5, null: false
27
+ t.string "invoice", limit: 9, null: false
28
+ t.string "abemail", limit: 40, null: false
29
+ t.string "abestatus", limit: 1, null: false
30
+ t.string "mbrdate", limit: 8
31
+ t.string "cduesyr", limit: 4
32
+ t.string "pduesyr", limit: 4
33
+ t.string "nrendate", limit: 8
34
+ t.string "dob", limit: 8
35
+ t.string "family", limit: 7
36
+ t.string "died", limit: 8
37
+ end
38
+
39
+ create_table "djdesc", primary_key: "jobcode", id: { type: :string, limit: 5 }, charset: "latin1", comment: "dtb-created daily has active dist Job descritpions", force: :cascade do |t|
40
+ t.string "jdesc", limit: 100
41
+ t.string "rank", limit: 3, null: false
42
+ t.string "prank", limit: 3, null: false
43
+ t.string "OD1", limit: 1, null: false
44
+ t.string "OD2", limit: 1, null: false
45
+ t.string "ED1", limit: 1, null: false
46
+ t.string "Lev", limit: 1, null: false
47
+ t.string "EGA", limit: 1, null: false
48
+ t.string "Descript", limit: 7, null: false
49
+ t.string "OP", limit: 1
50
+ t.string "Sp", limit: 1
51
+ end
52
+
53
+ create_table "djftp", id: false, charset: "latin1", comment: "dtb - Current District Jobs loaded from HQ data", force: :cascade do |t|
54
+ t.string "certno", limit: 7, null: false
55
+ t.string "first", limit: 15
56
+ t.string "last", limit: 25
57
+ t.string "jobcode", limit: 5
58
+ t.string "year", limit: 4
59
+ t.integer "account", null: false
60
+ t.string "distno", limit: 2
61
+ t.string "acting", limit: 1
62
+ t.string "source", limit: 1
63
+ end
64
+
65
+ create_table "mbftp", primary_key: "certno", id: { type: :string, limit: 7 }, charset: "latin1", comment: "dtb-active membership created daily from HQ", force: :cascade do |t|
66
+ t.integer "id", null: false, auto_increment: true
67
+ t.integer "distno"
68
+ t.string "daccount", limit: 4
69
+ t.integer "sqdcode"
70
+ t.string "account", limit: 4
71
+ t.string "first", limit: 15
72
+ t.string "last", limit: 25
73
+ t.string "nick", limit: 15
74
+ t.string "nickpref", limit: 1
75
+ t.string "sex", limit: 1
76
+ t.string "address1", limit: 30
77
+ t.string "address2", limit: 30
78
+ t.string "city", limit: 30
79
+ t.string "state", limit: 2
80
+ t.string "zip5", limit: 5
81
+ t.string "zip4", limit: 4
82
+ t.string "mbrtype", limit: 2
83
+ t.string "mbrstatus", limit: 3
84
+ t.string "area", limit: 3
85
+ t.string "phone", limit: 7
86
+ t.string "area2", limit: 3
87
+ t.string "phone2", limit: 7
88
+ t.string "areac", limit: 3
89
+ t.string "phonec", limit: 7
90
+ t.string "email", limit: 40
91
+ t.string "estatus", limit: 1
92
+ t.integer "rank"
93
+ t.string "pastrank", limit: 3
94
+ t.string "sqdrank", limit: 3
95
+ t.string "grade", limit: 6
96
+ t.string "spcertno", limit: 7
97
+ t.string "spouse", limit: 30
98
+ t.string "ssex", limit: 1
99
+ t.string "edpro", limit: 8
100
+ t.string "edach", limit: 8
101
+ t.string "chap", limit: 8
102
+ t.string "years", limit: 2
103
+ t.string "mm", limit: 2
104
+ t.string "senior", limit: 4
105
+ t.string "life", limit: 4
106
+ t.string "vsc", limit: 8
107
+ t.string "idexpr", limit: 8
108
+ t.string "ot", limit: 8
109
+ t.string "ldao", limit: 8
110
+ t.string "ldxo", limit: 8
111
+ t.string "ldcdr", limit: 8
112
+ t.string "actcertno", limit: 7
113
+ t.string "mbrdate", limit: 8
114
+ t.string "trdate", limit: 8
115
+ t.string "pin", limit: 8
116
+ t.string "question", limit: 2
117
+ t.string "answer", limit: 25
118
+ t.string "bdu", limit: 8
119
+ t.string "hq", limit: 8
120
+ t.string "x", limit: 1
121
+ t.string "birth", limit: 8
122
+ t.string "ext", limit: 4
123
+ t.string "ok", limit: 1
124
+ t.string "areaf", limit: 3
125
+ t.string "fax", limit: 7
126
+ t.string "mmsi", limit: 9
127
+ t.string "callsign", limit: 7
128
+ t.string "seascout", limit: 1
129
+ t.integer "pdistno"
130
+ t.integer "psqdcode"
131
+ t.integer "odistno"
132
+ t.integer "osqdcode"
133
+ t.string "optout", limit: 1
134
+ t.string "jcode", limit: 1
135
+ t.string "lastmm", limit: 4
136
+ t.string "btype", limit: 30
137
+ t.string "bname", limit: 30
138
+ t.string "port", limit: 30
139
+ t.string "sptype", limit: 1
140
+ t.string "DB", limit: 1
141
+ t.string "DBdate", limit: 8
142
+ t.string "btemp", limit: 8
143
+ t.string "iMISid", limit: 8
144
+ t.index ["certno"], name: "certno", unique: true
145
+ t.index ["id"], name: "id_index"
146
+ end
147
+
148
+ create_table "njdesc", primary_key: "jobcode", id: { type: :string, limit: 7 }, charset: "latin1", comment: "dtb-created daily active nat job desc", force: :cascade do |t|
149
+ t.string "jdesc", limit: 100
150
+ t.string "admin", limit: 5, null: false
151
+ t.string "rank", limit: 3, null: false
152
+ t.string "prank", limit: 3, null: false
153
+ t.string "type", limit: 1, null: false
154
+ t.string "active", limit: 1, null: false
155
+ t.string "map", limit: 1, null: false
156
+ end
157
+
158
+ create_table "njftp", id: false, charset: "latin1", comment: "dtb-created daily from HQ active nat jobs", force: :cascade do |t|
159
+ t.string "certno", limit: 7, null: false
160
+ t.string "first", limit: 15
161
+ t.string "last", limit: 25
162
+ t.string "jobcode", limit: 7
163
+ t.string "year", limit: 4
164
+ t.string "distno", limit: 2
165
+ end
166
+
167
+ create_table "ranks", id: false, charset: "latin1", force: :cascade do |t|
168
+ t.string "RankCode", limit: 3
169
+ t.string "RankDesc", limit: 40
170
+ t.string "RankAbbr", limit: 15
171
+ end
172
+
173
+ create_table "sjdesc", primary_key: "jobcode", id: { type: :string, limit: 5 }, charset: "latin1", comment: "dtb-created daily has active squad Job descritpions", force: :cascade do |t|
174
+ t.string "jdesc", limit: 100
175
+ t.string "rank", limit: 3, null: false
176
+ t.string "prank", limit: 3, null: false
177
+ t.string "OD1", limit: 1, null: false
178
+ t.string "OD2", limit: 1, null: false
179
+ t.string "ED1", limit: 1, null: false
180
+ t.string "Lev", limit: 1, null: false
181
+ t.string "EGA", limit: 1, null: false
182
+ t.string "Descript", limit: 7, null: false
183
+ t.string "OP", limit: 1
184
+ t.string "Sp", limit: 1
185
+ end
186
+
187
+ create_table "sjftp", id: false, charset: "latin1", comment: "dtb-created daily from HQ active squadron jobs", force: :cascade do |t|
188
+ t.string "certno", limit: 7, null: false
189
+ t.string "first", limit: 15
190
+ t.string "last", limit: 25
191
+ t.string "jobcode", limit: 5
192
+ t.string "year", limit: 4
193
+ t.integer "account", null: false
194
+ t.string "distno", limit: 2
195
+ t.string "acting", limit: 1
196
+ t.string "source", limit: 1
197
+ end
198
+ end
@@ -0,0 +1,205 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # This file is the source Rails uses to define your schema when running `bin/rails
6
+ # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
+ # be faster and is potentially less error prone than running all of your
8
+ # migrations from scratch. Old migrations may fail to apply correctly if those
9
+ # migrations use external dependencies or application code.
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema[7.2].define(version: 2025_11_01_000000) do
14
+ create_table "mbrclasses", id: :integer, charset: "latin1", comment: "dtb-Active member classes", options: "ENGINE=InnoDB", force: :cascade do |t|
15
+ t.string "sqnumber", limit: 4
16
+ t.string "account", limit: 4
17
+ t.string "crsid", limit: 17
18
+ t.string "place", limit: 60
19
+ t.string "adr", limit: 60
20
+ t.string "city", limit: 35
21
+ t.string "state", limit: 2
22
+ t.string "tzone", limit: 1, default: ""
23
+ t.integer "dirid"
24
+ t.date "date"
25
+ t.time "time"
26
+ t.date "rdate"
27
+ t.time "rtime"
28
+ t.string "edate", limit: 11
29
+ t.string "etime", limit: 4, default: ""
30
+ t.date "cdate"
31
+ t.string "total", limit: 3
32
+ t.string "passed", limit: 3
33
+ t.string "failed", limit: 3
34
+ t.string "number", limit: 13
35
+ t.string "name", limit: 35
36
+ t.string "ccertno", limit: 7
37
+ t.string "email", limit: 50
38
+ t.string "estatus", limit: 1
39
+ t.string "type", limit: 7
40
+ t.string "year", limit: 2
41
+ t.string "Sp", limit: 1
42
+ t.string "owt", limit: 1
43
+ t.string "zip", limit: 5
44
+ t.date "modified"
45
+ t.string "lat", limit: 10
46
+ t.string "lon", limit: 10
47
+ t.string "oreg", limit: 1
48
+ t.string "accept", limit: 1
49
+ t.string "cost", limit: 5
50
+ t.string "mcost", limit: 5
51
+ t.string "maxnum", limit: 3
52
+ t.string "nopub", limit: 1
53
+ t.string "web", limit: 1
54
+ t.string "webid", limit: 19
55
+ t.string "vclass", limit: 1
56
+ t.string "oexam", limit: 1
57
+ t.integer "oexid", default: 0
58
+ t.string "format", limit: 1
59
+ t.string "media", limit: 15
60
+ t.string "status", limit: 1
61
+ t.text "notes"
62
+ t.string "schedule", limit: 50
63
+ t.string "certifier", limit: 7
64
+ t.string "certifier2", limit: 7
65
+ t.string "certifier3", limit: 7
66
+ t.string "certifier4", limit: 7
67
+ t.string "certifier5", limit: 7
68
+ t.string "certifier6", limit: 7
69
+ t.string "whoby", limit: 20
70
+ t.string "source", limit: 1
71
+ t.string "osource", limit: 1
72
+ t.string "orderno", limit: 5
73
+ t.string "invoice", limit: 7
74
+ t.index ["sqnumber"], name: "csq_index"
75
+ end
76
+
77
+ create_table "students", id: :integer, charset: "latin1", comment: "dtb-Active eddept HQ800 students", options: "ENGINE=MyISAM", force: :cascade do |t|
78
+ t.string "csl", limit: 1
79
+ t.string "crsid", limit: 17
80
+ t.string "start", limit: 6
81
+ t.string "seq", limit: 1
82
+ t.string "ctype", limit: 7
83
+ t.string "hours", limit: 2
84
+ t.string "Sp", limit: 1
85
+ t.string "owt", limit: 1
86
+ t.string "squadno", limit: 4
87
+ t.string "distno", limit: 2
88
+ t.string "certno", limit: 7
89
+ t.string "status", limit: 1
90
+ t.string "accept", limit: 1
91
+ t.string "grade", limit: 3
92
+ t.string "f_name", limit: 15
93
+ t.string "mi", limit: 5
94
+ t.string "l_name", limit: 25
95
+ t.string "nick", limit: 15
96
+ t.string "nickpref", limit: 1
97
+ t.string "address", limit: 30
98
+ t.string "address2", limit: 30
99
+ t.string "city", limit: 30
100
+ t.string "state", limit: 2
101
+ t.string "county", limit: 30
102
+ t.string "zip", limit: 5
103
+ t.string "zippl", limit: 4
104
+ t.string "phone", limit: 14
105
+ t.string "text", limit: 1, default: ""
106
+ t.string "email", limit: 40
107
+ t.string "estatus", limit: 1
108
+ t.string "birth_date", limit: 8
109
+ t.string "u18", limit: 1, default: ""
110
+ t.string "sex", limit: 1
111
+ t.string "SS4", limit: 4
112
+ t.string "eye_color", limit: 3
113
+ t.string "hair_color", limit: 3
114
+ t.string "ht_ft", limit: 1
115
+ t.string "ht_in", limit: 2
116
+ t.string "entered", limit: 6
117
+ t.string "ED26", limit: 6
118
+ t.integer "ed26id"
119
+ t.string "ED27", limit: 6
120
+ t.string "learned", limit: 30
121
+ t.string "boatsz", limit: 8
122
+ t.string "boattyp", limit: 8
123
+ t.string "boathp", limit: 8
124
+ t.string "trailer", limit: 1
125
+ t.string "boatyrs", limit: 2
126
+ t.string "optout", limit: 1
127
+ t.string "validate", limit: 7
128
+ t.string "certifier", limit: 7
129
+ t.string "certifier2", limit: 7
130
+ t.string "certifier3", limit: 7
131
+ t.string "source", limit: 1
132
+ t.string "osource", limit: 1
133
+ t.string "sstate", limit: 2
134
+ t.string "X01", limit: 1, default: ""
135
+ t.string "X02", limit: 1, default: ""
136
+ t.string "X03", limit: 1, default: ""
137
+ t.string "X04", limit: 1, default: ""
138
+ t.string "X05", limit: 1, default: ""
139
+ t.string "X06", limit: 1, default: ""
140
+ t.string "X07", limit: 1, default: ""
141
+ t.string "X08", limit: 1, default: ""
142
+ t.string "X09", limit: 1, default: ""
143
+ t.string "X10", limit: 1, default: ""
144
+ t.string "crdtype", limit: 1
145
+ end
146
+
147
+ create_table "websites", id: :integer, charset: "latin1", comment: "dtb-Accounts profiles (squadrons, districts, BOC regins,etc)", options: "ENGINE=InnoDB PACK_KEYS=1", force: :cascade do |t|
148
+ t.string "type", limit: 1, default: "", null: false
149
+ t.string "Name", limit: 35, default: "", null: false
150
+ t.string "DBA", limit: 50
151
+ t.string "url", limit: 75, default: "", null: false
152
+ t.string "newsletter", limit: 40
153
+ t.string "email", limit: 50, default: "", null: false
154
+ t.string "contact", limit: 30, default: "", null: false
155
+ t.string "tel", limit: 15, default: "", null: false
156
+ t.string "ceforce", limit: 1
157
+ t.string "region", limit: 60, default: "", null: false
158
+ t.string "burgee", limit: 200
159
+ t.string "dist", limit: 3, default: "", null: false
160
+ t.string "daccount", limit: 4
161
+ t.string "state", limit: 2, default: "", null: false
162
+ t.string "tzone", limit: 1
163
+ t.string "sqnumber", limit: 5, default: "", null: false
164
+ t.integer "account", null: false
165
+ t.string "initials", limit: 3
166
+ t.string "modified", limit: 8
167
+ t.string "who", limit: 8
168
+ t.string "prov", limit: 1
169
+ t.string "sail", limit: 1
170
+ t.string "pcontact", limit: 30
171
+ t.string "ptel", limit: 15
172
+ t.string "pemail", limit: 50
173
+ t.string "peforce", limit: 1
174
+ t.string "pceforce", limit: 1
175
+ t.string "pzip", limit: 5
176
+ t.string "plat", limit: 10
177
+ t.string "plon", limit: 10
178
+ t.string "zoom", limit: 2
179
+ t.string "nonconform", limit: 1
180
+ t.string "chartered", limit: 4
181
+ t.string "bylaws", limit: 50
182
+ t.string "roster", limit: 30
183
+ t.string "ncreason"
184
+ t.string "roptions", limit: 30
185
+ t.string "cauth", limit: 50
186
+ t.string "dauth", limit: 50
187
+ t.string "pauth", limit: 50
188
+ t.string "history", limit: 35
189
+ t.string "retired", limit: 1
190
+ t.string "ccert", limit: 7
191
+ t.string "oldccert", limit: 7
192
+ t.string "pcert", limit: 7
193
+ t.string "oldpcert", limit: 7
194
+ t.string "rcert", limit: 7
195
+ t.string "oldrcert", limit: 7
196
+ t.string "rceforce", limit: 1
197
+ t.string "county", limit: 15
198
+ t.string "tax", limit: 4
199
+ t.string "facebook"
200
+ t.string "ExPicLib", limit: 75
201
+ t.index ["Name"], name: "Name_index"
202
+ t.index ["dist"], name: "dist_index"
203
+ t.index ["sqnumber"], name: "wsq_index"
204
+ end
205
+ end
@@ -87,7 +87,9 @@ module Usps::Support::Helpers
87
87
  when 'success' then :brightgreen
88
88
  when 'failure', 'timed_out', 'action_required' then :red
89
89
  when 'cancelled' then :orange
90
- when 'neutral', 'skipped' then :lightgray
90
+ else
91
+ # includes 'neutral', 'skipped'
92
+ :lightgray
91
93
  end
92
94
  else
93
95
  :lightgray
@@ -104,8 +106,10 @@ module Usps::Support::Helpers
104
106
  timestamp =
105
107
  case datetime
106
108
  when Integer then datetime
107
- when String then DateTime.strptime(datetime).in_time_zone('Eastern Time (US & Canada)').to_i
109
+ when String then DateTime.strptime(datetime, options[:format]).in_time_zone('Eastern Time (US & Canada)').to_i
108
110
  when DateTime, Time then datetime.to_i
111
+ else
112
+ raise "Unrecognized datetime format: #{datetime.inspect}"
109
113
  end
110
114
 
111
115
  query = options.slice(:label, :logo)
@@ -126,6 +130,7 @@ module Usps::Support::Helpers
126
130
  end
127
131
 
128
132
  # rubocop:disable Metrics/AbcSize
133
+ # rubocop:disable Style/EmptyElse
129
134
  def timestamp_color(timestamp)
130
135
  case Time.zone.at(timestamp.to_i)
131
136
  when ...14.days.ago then '63a2c7' # faded :blue
@@ -134,8 +139,13 @@ module Usps::Support::Helpers
134
139
  when 1.hour.ago...1.minute.ago, 1.minute.from_now...10.minutes.from_now then :yellowgreen
135
140
  when 1.minute.ago...1.minute.from_now then :orange
136
141
  when 1.hour.from_now.. then :brightgreen
142
+ else
143
+ # :nocov:
144
+ # Unreachable
145
+ # :nocov:
137
146
  end
138
147
  end
148
+ # rubocop:enable Style/EmptyElse
139
149
  # rubocop:enable Metrics/AbcSize
140
150
  end
141
151
  end
@@ -6,39 +6,12 @@ module Usps::Support::Helpers
6
6
  module FlagsHelper
7
7
  FLAGS_BASE_URL = 'https://flags.aws.usps.org'
8
8
  SIGNAL_BASE_URL = 'https://flags.aws.usps.org/signals'
9
- RANKS = {
10
- '31000' => 'CDR', '32000' => 'LTC', '31010' => 'LT',
11
- '21000' => 'DC', '22000' => 'DLTC', '21010' => 'DLT',
12
- '11000' => 'CC'
13
- }.freeze
14
- RANK_PATTERNS = {
15
- /1\d000/ => 'VC', /1\d{3}0/ => 'RC', /1\d{3}1/ => 'STFC'
16
- }.freeze
17
9
 
18
10
  def officer_flag(rank, format: :svg, size: nil)
19
11
  size = ".#{size}" unless size.nil?
20
12
  image_tag("#{FLAGS_BASE_URL}/#{format.to_s.upcase}/#{rank}#{size}.#{format}", alt: rank)
21
13
  end
22
14
 
23
- def officer_flag_for_organization(jobcode)
24
- rank = RANKS[jobcode] || RANK_PATTERNS.find { |p, _r| jobcode =~ p }[1]
25
- officer_flag(rank, format: :png, size: 500)
26
- end
27
-
28
- def officer_flag_for_submission(submission)
29
- if submission.squadron.present?
30
- officer_flag('CDR', format: :png, size: 500)
31
- elsif submission.district.present?
32
- officer_flag('DC', format: :png, size: 500)
33
- elsif submission.organization == '11000'
34
- officer_flag('CC', format: :png, size: 500)
35
- elsif submission.organization =~ /1\d000/
36
- officer_flag('VC', format: :png, size: 500)
37
- else
38
- officer_flag('RC', format: :png, size: 500)
39
- end
40
- end
41
-
42
15
  def signal_flags(text, format: :svg)
43
16
  safe_join(text.scan(/[A-Za-z0-9\s]/).map(&:downcase).split { |s| s =~ /\s/ }.map do |word|
44
17
  content_tag(:div, class: 'word') do
@@ -3,6 +3,7 @@
3
3
  module Usps::Support::Helpers
4
4
  # Get git identifying information
5
5
  #
6
+ # :nocov:
6
7
  module GitHelper
7
8
  def current_git_tag
8
9
  prod_current_tag if Rails.env.production?
@@ -10,7 +11,6 @@ module Usps::Support::Helpers
10
11
  dev_current_tag if Rails.env.development?
11
12
  end
12
13
 
13
- # :nocov:
14
14
  def prod_current_tag
15
15
  @current_git_tag = Rails.root.join('TAG').read.chomp
16
16
  @current_branch = Rails.root.join('BRANCH').read.chomp
@@ -20,6 +20,6 @@ module Usps::Support::Helpers
20
20
  @current_git_tag = `git describe --tags --abbrev=0`.chomp
21
21
  @current_branch = `git branch --show-current`.chomp
22
22
  end
23
- # :nocov:
24
23
  end
24
+ # :nocov:
25
25
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :nocov:
3
4
  module Usps::Support::Helpers
4
5
  # Build CSS for mailers
5
6
  #
@@ -7,7 +8,10 @@ module Usps::Support::Helpers
7
8
  def render_scss(file)
8
9
  text = Rails.root.join("app/views/layouts/scss/#{file}.scss").read
9
10
 
11
+ # rubocop:disable Rails/OutputSafety
12
+ # No user content
10
13
  raw sass_engine(text).render
14
+ # rubocop:enable Rails/OutputSafety
11
15
  end
12
16
 
13
17
  def sass_engine(text)
@@ -24,3 +28,4 @@ module Usps::Support::Helpers
24
28
  end
25
29
  end
26
30
  end
31
+ # :nocov:
@@ -25,7 +25,7 @@ module Usps::Support::Models::Hq::Members
25
25
 
26
26
  validate :enforce_account
27
27
 
28
- def acting? = acting == 'Y'
28
+ enum :acting, { standard: '', acting: 'Y' }
29
29
 
30
30
  def description
31
31
  desc = district_job_description.jdesc
@@ -6,11 +6,15 @@ module Usps::Support::Models::Hq::Members
6
6
  class DistrictJobDescription < BaseRecord
7
7
  self.table_name = :djdesc
8
8
  self.primary_key = :jobcode
9
+ self.inheritance_column = nil # The database has a `type` column, which confuses with Rails STI
9
10
 
10
11
  has_many(
11
12
  :district_jobs,
12
13
  class_name: '::Members::DistrictJob',
13
14
  foreign_key: :jobcode, primary_key: :jobcode, inverse_of: :district_job_description
14
15
  )
16
+
17
+ # Not consistent in the database
18
+ enum :type, { bridge: 'D', elected: 'J', committee: 'C', appointed: 'A' }, default: :appointed
15
19
  end
16
20
  end
@@ -54,7 +54,8 @@ module Usps::Support::Models::Hq::Members
54
54
 
55
55
  def rank
56
56
  return @rank if @rank
57
- return unless (raw_rank = read_attribute(:rank))
57
+
58
+ raw_rank = read_attribute(:rank)
58
59
  return if raw_rank.in?(INVALID_RANKS)
59
60
 
60
61
  normalized_rank = raw_rank.to_s.rjust(2, '0')
@@ -14,11 +14,27 @@ module Usps::Support::Models::Hq::Members
14
14
  foreign_key: :jobcode, primary_key: :jobcode, inverse_of: :national_job_description
15
15
  )
16
16
 
17
+ # Not consistent in the database
18
+ enum(
19
+ :type,
20
+ {
21
+ general: 'G',
22
+ bridge: 'D',
23
+ appointed: 'J',
24
+ chair: 'C',
25
+ assistant: 'A',
26
+ leadership: 'L',
27
+ member: 'M',
28
+ past: 'E'
29
+ },
30
+ default: :appointed
31
+ )
32
+
17
33
  def description
18
- return 'Budget Director' if jdesc =~ %r{/Budget Director$}
34
+ return 'Budget Director' if jdesc =~ /Budget Director/
19
35
 
20
36
  jdesc
21
- .sub(/^(?:Assistant|Asst\.)?\s?(?:Chr\.|Chair\.|Chairman)? /, '')
37
+ .sub(/^(?:Assistant|Ass?t\.?)?\s?(?:Chr\.|Chair\.|Chairman)? /, '')
22
38
  .sub(/ (?:Committee|Cmte|Com\.)$/, '')
23
39
  end
24
40
  end
@@ -25,7 +25,7 @@ module Usps::Support::Models::Hq::Members
25
25
 
26
26
  validate :enforce_account
27
27
 
28
- def acting? = acting == 'Y'
28
+ enum :acting, { standard: '', acting: 'Y' }
29
29
 
30
30
  def description
31
31
  desc = squadron_job_description.jdesc
@@ -6,11 +6,15 @@ module Usps::Support::Models::Hq::Members
6
6
  class SquadronJobDescription < BaseRecord
7
7
  self.table_name = :sjdesc
8
8
  self.primary_key = :jobcode
9
+ self.inheritance_column = nil # The database has a `type` column, which confuses with Rails STI
9
10
 
10
11
  has_many(
11
12
  :squadron_jobs,
12
13
  class_name: '::Members::SquadronJob',
13
14
  foreign_key: :jobcode, primary_key: :jobcode, inverse_of: :squadron_job_description
14
15
  )
16
+
17
+ # Not consistent in the database
18
+ enum :type, { bridge: 'D', elected: 'J', committee: 'C', appointed: 'A', general: 'G' }, default: :appointed
15
19
  end
16
20
  end
@@ -3,6 +3,7 @@
3
3
  module Usps::Support::Models::Hq
4
4
  # Base record for the HQ VHQAB database
5
5
  #
6
+ # rubocop:disable Rails/ApplicationRecord
6
7
  class SharedRecord < ::ActiveRecord::Base
7
8
  self.abstract_class = true
8
9
 
@@ -10,4 +11,5 @@ module Usps::Support::Models::Hq
10
11
 
11
12
  def self.allow_hq_database_edits? = false
12
13
  end
14
+ # rubocop:enable Rails/ApplicationRecord
13
15
  end
@@ -12,7 +12,7 @@ module Usps::Support::Models::Hq::Squadrons
12
12
  has_many(
13
13
  :former_squadrons,
14
14
  class_name: '::Squadrons::FormerSquadron',
15
- inverse_of: :district, foreign_key: 'daccount', primary_key: 'sqdno'
15
+ inverse_of: :district, foreign_key: 'daccount', primary_key: 'daccount'
16
16
  )
17
17
 
18
18
  has_many(
@@ -40,6 +40,6 @@ module Usps::Support::Models::Hq::Squadrons
40
40
 
41
41
  # def name = "District #{number}"
42
42
 
43
- # def all_squadrons = (squadrons + former_squadrons).sort_by(&:name)
43
+ def all_squadrons = (squadrons + former_squadrons).sort_by(&:name)
44
44
  end
45
45
  end
@@ -6,10 +6,9 @@ module Usps::Support::Models::Hq::Squadrons
6
6
  class FormerSquadron < Website
7
7
  belongs_to(
8
8
  :district,
9
- -> { where(account: [0, nil]) },
10
9
  inverse_of: :former_squadrons,
11
10
  foreign_key: 'daccount',
12
- primary_key: 'plat'
11
+ primary_key: 'daccount'
13
12
  )
14
13
 
15
14
  # Former Squadrons stored in the same table as current Squadrons
@@ -37,7 +37,7 @@ module Usps::Support::Models
37
37
  def to_s
38
38
  attributes = to_h.map { |key, value| "@#{key}=#{value.inspect}" }.join(' ')
39
39
 
40
- "#<Toast:#{object_id} #{attributes}>"
40
+ "#<Toast #{attributes}>"
41
41
  end
42
42
  alias inspect to_s
43
43
 
@@ -51,6 +51,8 @@ module Usps::Support::Models
51
51
  }
52
52
  end
53
53
 
54
+ def ==(other) = to_h == other.to_h
55
+
54
56
  def to_json(*_)
55
57
  validate!
56
58
 
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails'
4
+
5
+ module Usps
6
+ module Support
7
+ # Expose rake tasks to Rails
8
+ #
9
+ class Railtie < Rails::Railtie
10
+ railtie_name :usps_support
11
+
12
+ rake_tasks do
13
+ path = File.expand_path(__dir__)
14
+ Dir.glob("#{path}/../../tasks/**/*.rake").each { |f| load f }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Usps
4
4
  module Support
5
- VERSION = '0.1.16'
5
+ VERSION = '0.1.18'
6
6
  end
7
7
  end
data/lib/usps/support.rb CHANGED
@@ -12,3 +12,7 @@ end
12
12
 
13
13
  require_relative 'support/helpers'
14
14
  require_relative 'support/models'
15
+
16
+ # :nocov:
17
+ require 'usps/support/railtie' if defined?(Rails)
18
+ # :nocov:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usps-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Fiander
@@ -58,21 +58,18 @@ executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
- - ".ruby-version"
62
- - Gemfile.lock
63
- - Rakefile
64
61
  - Readme.md
65
62
  - lib/usps/all.rb
66
63
  - lib/usps/support.rb
64
+ - lib/usps/support/db/members_schema.rb
65
+ - lib/usps/support/db/websites_schema.rb
67
66
  - lib/usps/support/helpers.rb
68
- - lib/usps/support/helpers/.rubocop.yml
69
67
  - lib/usps/support/helpers/badges_helper.rb
70
68
  - lib/usps/support/helpers/flags_helper.rb
71
69
  - lib/usps/support/helpers/git_helper.rb
72
70
  - lib/usps/support/helpers/react_helper.rb
73
71
  - lib/usps/support/helpers/scss_helper.rb
74
72
  - lib/usps/support/models.rb
75
- - lib/usps/support/models/.rubocop.yml
76
73
  - lib/usps/support/models/dynamo_db.rb
77
74
  - lib/usps/support/models/git_hub.rb
78
75
  - lib/usps/support/models/hq.rb
@@ -96,8 +93,8 @@ files:
96
93
  - lib/usps/support/models/hq/squadrons/squadron.rb
97
94
  - lib/usps/support/models/hq/squadrons/website.rb
98
95
  - lib/usps/support/models/toast.rb
96
+ - lib/usps/support/railtie.rb
99
97
  - lib/usps/support/version.rb
100
- - sig/usps/support.rbs
101
98
  homepage: https://github.com/unitedstatespowersquadrons/usps-rails
102
99
  licenses: []
103
100
  metadata:
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.4.6
data/Gemfile.lock DELETED
@@ -1,241 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- usps-support (0.1.16)
5
- sassc-rails
6
- usps-imis-api (~> 0.10.4)
7
- usps-jwt_auth (~> 1.0.0)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actionpack (8.0.4)
13
- actionview (= 8.0.4)
14
- activesupport (= 8.0.4)
15
- nokogiri (>= 1.8.5)
16
- rack (>= 2.2.4)
17
- rack-session (>= 1.0.1)
18
- rack-test (>= 0.6.3)
19
- rails-dom-testing (~> 2.2)
20
- rails-html-sanitizer (~> 1.6)
21
- useragent (~> 0.16)
22
- actionview (8.0.4)
23
- activesupport (= 8.0.4)
24
- builder (~> 3.1)
25
- erubi (~> 1.11)
26
- rails-dom-testing (~> 2.2)
27
- rails-html-sanitizer (~> 1.6)
28
- activesupport (8.0.4)
29
- base64
30
- benchmark (>= 0.3)
31
- bigdecimal
32
- concurrent-ruby (~> 1.0, >= 1.3.1)
33
- connection_pool (>= 2.2.5)
34
- drb
35
- i18n (>= 1.6, < 2)
36
- logger (>= 1.4.2)
37
- minitest (>= 5.1)
38
- securerandom (>= 0.3)
39
- tzinfo (~> 2.0, >= 2.0.5)
40
- uri (>= 0.13.1)
41
- ast (2.4.3)
42
- base64 (0.3.0)
43
- benchmark (0.5.0)
44
- bigdecimal (3.3.1)
45
- builder (3.3.0)
46
- colorize (1.1.0)
47
- concurrent-ruby (1.3.5)
48
- connection_pool (2.5.4)
49
- crass (1.0.6)
50
- date (3.4.1)
51
- diff-lcs (1.6.2)
52
- docile (1.4.1)
53
- drb (2.2.3)
54
- erb (5.1.3)
55
- erubi (1.13.1)
56
- ffi (1.17.2-aarch64-linux-gnu)
57
- ffi (1.17.2-aarch64-linux-musl)
58
- ffi (1.17.2-arm-linux-gnu)
59
- ffi (1.17.2-arm-linux-musl)
60
- ffi (1.17.2-arm64-darwin)
61
- ffi (1.17.2-x86_64-darwin)
62
- ffi (1.17.2-x86_64-linux-gnu)
63
- ffi (1.17.2-x86_64-linux-musl)
64
- fileutils (1.7.3)
65
- i18n (1.14.7)
66
- concurrent-ruby (~> 1.0)
67
- io-console (0.8.1)
68
- irb (1.15.2)
69
- pp (>= 0.6.0)
70
- rdoc (>= 4.0.0)
71
- reline (>= 0.4.2)
72
- json (2.15.2)
73
- jwt (3.1.2)
74
- base64
75
- language_server-protocol (3.17.0.5)
76
- lint_roller (1.1.0)
77
- logger (1.7.0)
78
- loofah (2.24.1)
79
- crass (~> 1.0.2)
80
- nokogiri (>= 1.12.0)
81
- minitest (5.26.0)
82
- nokogiri (1.18.10-aarch64-linux-gnu)
83
- racc (~> 1.4)
84
- nokogiri (1.18.10-aarch64-linux-musl)
85
- racc (~> 1.4)
86
- nokogiri (1.18.10-arm-linux-gnu)
87
- racc (~> 1.4)
88
- nokogiri (1.18.10-arm-linux-musl)
89
- racc (~> 1.4)
90
- nokogiri (1.18.10-arm64-darwin)
91
- racc (~> 1.4)
92
- nokogiri (1.18.10-x86_64-darwin)
93
- racc (~> 1.4)
94
- nokogiri (1.18.10-x86_64-linux-gnu)
95
- racc (~> 1.4)
96
- nokogiri (1.18.10-x86_64-linux-musl)
97
- racc (~> 1.4)
98
- parallel (1.27.0)
99
- parser (3.3.10.0)
100
- ast (~> 2.4.1)
101
- racc
102
- pp (0.6.3)
103
- prettyprint
104
- prettyprint (0.2.0)
105
- prism (1.6.0)
106
- psych (5.2.6)
107
- date
108
- stringio
109
- racc (1.8.1)
110
- rack (3.2.3)
111
- rack-session (2.1.1)
112
- base64 (>= 0.1.0)
113
- rack (>= 3.0.0)
114
- rack-test (2.2.0)
115
- rack (>= 1.3)
116
- rackup (2.2.1)
117
- rack (>= 3)
118
- rails-dom-testing (2.3.0)
119
- activesupport (>= 5.0.0)
120
- minitest
121
- nokogiri (>= 1.6)
122
- rails-html-sanitizer (1.6.2)
123
- loofah (~> 2.21)
124
- nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
125
- railties (8.0.4)
126
- actionpack (= 8.0.4)
127
- activesupport (= 8.0.4)
128
- irb (~> 1.13)
129
- rackup (>= 1.0.0)
130
- rake (>= 12.2)
131
- thor (~> 1.0, >= 1.2.2)
132
- tsort (>= 0.2)
133
- zeitwerk (~> 2.6)
134
- rainbow (3.1.1)
135
- rake (13.3.0)
136
- rdoc (6.15.0)
137
- erb
138
- psych (>= 4.0.0)
139
- tsort
140
- regexp_parser (2.11.3)
141
- reline (0.6.2)
142
- io-console (~> 0.5)
143
- rspec (3.13.2)
144
- rspec-core (~> 3.13.0)
145
- rspec-expectations (~> 3.13.0)
146
- rspec-mocks (~> 3.13.0)
147
- rspec-core (3.13.6)
148
- rspec-support (~> 3.13.0)
149
- rspec-expectations (3.13.5)
150
- diff-lcs (>= 1.2.0, < 2.0)
151
- rspec-support (~> 3.13.0)
152
- rspec-mocks (3.13.6)
153
- diff-lcs (>= 1.2.0, < 2.0)
154
- rspec-support (~> 3.13.0)
155
- rspec-support (3.13.6)
156
- rubocop (1.81.6)
157
- json (~> 2.3)
158
- language_server-protocol (~> 3.17.0.2)
159
- lint_roller (~> 1.1.0)
160
- parallel (~> 1.10)
161
- parser (>= 3.3.0.2)
162
- rainbow (>= 2.2.2, < 4.0)
163
- regexp_parser (>= 2.9.3, < 3.0)
164
- rubocop-ast (>= 1.47.1, < 2.0)
165
- ruby-progressbar (~> 1.7)
166
- unicode-display_width (>= 2.4.0, < 4.0)
167
- rubocop-ast (1.47.1)
168
- parser (>= 3.3.7.2)
169
- prism (~> 1.4)
170
- rubocop-rake (0.7.1)
171
- lint_roller (~> 1.1)
172
- rubocop (>= 1.72.1)
173
- rubocop-rspec (3.7.0)
174
- lint_roller (~> 1.1)
175
- rubocop (~> 1.72, >= 1.72.1)
176
- ruby-progressbar (1.13.0)
177
- sassc (2.4.0)
178
- ffi (~> 1.9)
179
- sassc-rails (2.1.2)
180
- railties (>= 4.0.0)
181
- sassc (>= 2.0)
182
- sprockets (> 3.0)
183
- sprockets-rails
184
- tilt
185
- securerandom (0.4.1)
186
- simplecov (0.22.0)
187
- docile (~> 1.1)
188
- simplecov-html (~> 0.11)
189
- simplecov_json_formatter (~> 0.1)
190
- simplecov-html (0.13.2)
191
- simplecov_json_formatter (0.1.4)
192
- sprockets (4.2.2)
193
- concurrent-ruby (~> 1.0)
194
- logger
195
- rack (>= 2.2.4, < 4)
196
- sprockets-rails (3.5.2)
197
- actionpack (>= 6.1)
198
- activesupport (>= 6.1)
199
- sprockets (>= 3.0.0)
200
- stringio (3.1.7)
201
- thor (1.4.0)
202
- tilt (2.6.1)
203
- tsort (0.2.0)
204
- tzinfo (2.0.6)
205
- concurrent-ruby (~> 1.0)
206
- unicode-display_width (3.2.0)
207
- unicode-emoji (~> 4.1)
208
- unicode-emoji (4.1.0)
209
- uri (1.0.4)
210
- useragent (0.16.11)
211
- usps-imis-api (0.10.4)
212
- activesupport (~> 8.0)
213
- usps-jwt_auth (1.0.0)
214
- activesupport (~> 8.0)
215
- colorize (~> 1.1)
216
- fileutils (~> 1.7)
217
- jwt (~> 3.1)
218
- zeitwerk (2.7.3)
219
-
220
- PLATFORMS
221
- aarch64-linux-gnu
222
- aarch64-linux-musl
223
- arm-linux-gnu
224
- arm-linux-musl
225
- arm64-darwin
226
- x86_64-darwin
227
- x86_64-linux-gnu
228
- x86_64-linux-musl
229
-
230
- DEPENDENCIES
231
- irb
232
- rake (~> 13.0)
233
- rspec (~> 3.0)
234
- rubocop (~> 1.81)
235
- rubocop-rake (~> 0.7)
236
- rubocop-rspec (~> 3.7)
237
- simplecov (~> 0.22)
238
- usps-support!
239
-
240
- BUNDLED WITH
241
- 2.7.2
data/Rakefile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
-
6
- RSpec::Core::RakeTask.new(:spec)
7
-
8
- require 'rubocop/rake_task'
9
-
10
- RuboCop::RakeTask.new
11
-
12
- task default: %i[spec rubocop]
@@ -1,18 +0,0 @@
1
- inherit_from: ../../../../.rubocop.yml
2
-
3
- Metrics/ClassLength:
4
- Enabled: true
5
- Max: 150
6
- Metrics/ModuleLength:
7
- Max: 150
8
- Metrics/CyclomaticComplexity:
9
- Enabled: true
10
- Max: 15
11
- Metrics/PerceivedComplexity:
12
- Max: 15
13
- Metrics/AbcSize:
14
- Enabled: true
15
- Max: 25
16
- Metrics/MethodLength:
17
- Enabled: true
18
- Max: 25
@@ -1,18 +0,0 @@
1
- inherit_from: ../../../../.rubocop.yml
2
-
3
- Metrics/ClassLength:
4
- Enabled: true
5
- Max: 250
6
- Metrics/ModuleLength:
7
- Max: 250
8
- Metrics/CyclomaticComplexity:
9
- Enabled: true
10
- Max: 15
11
- Metrics/PerceivedComplexity:
12
- Max: 15
13
- Metrics/AbcSize:
14
- Enabled: true
15
- Max: 25
16
- Metrics/MethodLength:
17
- Enabled: true
18
- Max: 25
data/sig/usps/support.rbs DELETED
@@ -1,6 +0,0 @@
1
- module Usps
2
- module Support
3
- VERSION: String
4
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
- end
6
- end