Skip to content

Commit

Permalink
Revert several inflection PRs causing (potential) problems on product…
Browse files Browse the repository at this point in the history
…ion (#4456)
  • Loading branch information
johnpaulashenfelter authored Jun 26, 2020
1 parent ffbe132 commit d90e249
Show file tree
Hide file tree
Showing 128 changed files with 297 additions and 312 deletions.
2 changes: 1 addition & 1 deletion app/controllers/v0/facilities/va_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'will_paginate/array'

class V0::Facilities::VAController < FacilitiesController
class V0::Facilities::VaController < FacilitiesController
TYPE_SERVICE_ERR = 'Filtering by services is not allowed unless a facility type is specified'
before_action :validate_params, only: [:index]
before_action :validate_types_name_part, only: [:suggested]
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/v0/mhv_accounts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module V0
class MHVAccountsController < ApplicationController
class MhvAccountsController < ApplicationController
CREATE_ERROR = 'You are not eligible for creating an MHV account'
UPGRADE_ERROR = 'You are not eligible for upgrading an MHV account'
include ActionController::Serialization
Expand Down Expand Up @@ -35,12 +35,12 @@ def mhv_account
end

def mhv_accounts_service
@mhv_accounts_service ||= MHVAccountsService.new(mhv_account, current_user)
@mhv_accounts_service ||= MhvAccountsService.new(mhv_account, current_user)
end

def render_account(status: :ok)
render json: mhv_account,
serializer: MHVAccountSerializer,
serializer: MhvAccountSerializer,
status: status
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module V0
module Profile
class ValidVAFileNumbersController < ApplicationController
class ValidVaFileNumbersController < ApplicationController
before_action { authorize :bgs, :access? }

def show
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v1/facilities/va_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class V1::Facilities::VAController < FacilitiesController
class V1::Facilities::VaController < FacilitiesController
# Index supports the following query parameters:
# @param bbox - Bounding box in form "xmin,ymin,xmax,ymax" in Lat/Long coordinates
# @param type - Optional facility type, values = all (default), health, benefits, cemetery
Expand Down
4 changes: 2 additions & 2 deletions app/models/evss_claim_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def known_document_type?
def unencrypted_pdf?
return unless file_name.match?(/\.pdf$/i)

metadata = PDFInfo::Metadata.read(file_obj.tempfile)
metadata = PdfInfo::Metadata.read(file_obj.tempfile)
errors.add(:base, 'PDF must not be encrypted') if metadata.encrypted?
file_obj.tempfile.rewind
rescue PDFInfo::MetadataReadError
rescue PdfInfo::MetadataReadError
errors.add(:base, 'PDF is malformed')
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/mhv_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
##
# Models an MHV Account
#
class MHVAccount < ApplicationRecord
class MhvAccount < ApplicationRecord
include AASM
# http://grafana.vetsgov-internal/dashboard/db/mhv-account-creation
# the following scopes are used for dashboard metrics in grafana and are collected
Expand Down
2 changes: 1 addition & 1 deletion app/models/persistent_attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class PersistentAttachment < ApplicationRecord
delegate :original_filename, :size, to: :file

def to_pdf
Common::ConvertToPDF.new(file).run
Common::ConvertToPdf.new(file).run
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/models/saved_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def form_matches_schema
end

def to_pdf
PDFFill::Filler.fill_form(self)
PdfFill::Filler.fill_form(self)
end

private
Expand Down
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def mhv_correlation_id
end

def mhv_account_type
identity.mhv_account_type || MHVAccountTypeService.new(self).mhv_account_type
identity.mhv_account_type || MhvAccountTypeService.new(self).mhv_account_type
end

def mhv_account_state
Expand Down Expand Up @@ -218,7 +218,7 @@ def identity_proofed?
end

def mhv_account
@mhv_account ||= MHVAccount.find_or_initialize_by(user_uuid: uuid, mhv_correlation_id: mhv_correlation_id)
@mhv_account ||= MhvAccount.find_or_initialize_by(user_uuid: uuid, mhv_correlation_id: mhv_correlation_id)
.tap { |m| m.user = self } # MHV account should not re-initialize use
end

Expand Down
2 changes: 1 addition & 1 deletion app/policies/mhv_account_creation_policy.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

MHVAccountCreationPolicy = Struct.new(:user, :mhv_account_creation) do
MhvAccountCreationPolicy = Struct.new(:user, :mhv_account_creation) do
def access?
user.mhv_account.creatable? || user.mhv_account.upgradable?
end
Expand Down
2 changes: 1 addition & 1 deletion app/policies/mhv_health_records_policy.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

MHVHealthRecordsPolicy = Struct.new(:user, :mhv_health_records) do
MhvHealthRecordsPolicy = Struct.new(:user, :mhv_health_records) do
BB_ACCOUNT_TYPES = %w[Premium Advanced Basic].freeze

def access?
Expand Down
2 changes: 1 addition & 1 deletion app/policies/mhv_messaging_policy.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

MHVMessagingPolicy = Struct.new(:user, :mhv_messaging) do
MhvMessagingPolicy = Struct.new(:user, :mhv_messaging) do
SM_ACCOUNT_TYPES = %w[Premium].freeze

def access?
Expand Down
2 changes: 1 addition & 1 deletion app/policies/mhv_prescriptions_policy.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

MHVPrescriptionsPolicy = Struct.new(:user, :mhv_prescriptions) do
MhvPrescriptionsPolicy = Struct.new(:user, :mhv_prescriptions) do
RX_ACCOUNT_TYPES = %w[Premium Advanced].freeze

# NOTE: This check for va_patient, might break functionality for mhv-sign-in users,
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/mhv_account_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class MHVAccountSerializer < ActiveModel::Serializer
class MhvAccountSerializer < ActiveModel::Serializer
attribute :account_level
attribute :account_state
attribute :terms_and_conditions_accepted
Expand Down
6 changes: 3 additions & 3 deletions app/services/bgs/people_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module BGS
class PeopleService
include SentryLogging
class VAFileNumberNotFound < StandardError; end
class VaFileNumberNotFound < StandardError; end

def initialize(current_user)
@current_user = current_user
Expand All @@ -12,10 +12,10 @@ def initialize(current_user)
def find_person_by_participant_id
response = service.people.find_person_by_ptcpnt_id(@current_user.participant_id)

raise VAFileNumberNotFound if response.nil?
raise VaFileNumberNotFound if response.nil?

response
rescue VAFileNumberNotFound => e
rescue VaFileNumberNotFound => e
report_no_va_file_user(e)

{}
Expand Down
6 changes: 3 additions & 3 deletions app/services/mhv_account_type_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
#
# @param user [User] the user object
#
class MHVAccountTypeService
class MhvAccountTypeService
include SentryLogging
ELIGIBLE_DATA_CLASS_COUNT_TO_ACCOUNT_LEVEL = {
32 => 'Premium',
18 => 'Advanced',
16 => 'Basic'
}.freeze
DEFAULT_ACCOUNT_LEVEL = 'Unknown'
MHV_DOWN_MESSAGE = 'MHVAccountTypeService: could not fetch eligible data classes'
UNEXPECTED_DATA_CLASS_COUNT_MESSAGE = 'MHVAccountTypeService: eligible data class mapping inconsistency'
MHV_DOWN_MESSAGE = 'MhvAccountTypeService: could not fetch eligible data classes'
UNEXPECTED_DATA_CLASS_COUNT_MESSAGE = 'MhvAccountTypeService: eligible data class mapping inconsistency'

def initialize(user)
@user = user
Expand Down
4 changes: 2 additions & 2 deletions app/services/mhv_accounts_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
##
# Models MHV Account creation and upgrade logic processes
#
# @param mhv_account [MHVAccount] the user's MHVAccount object from DB
# @param mhv_account [MhvAccount] the user's MhvAccount object from DB
# @param user [User] the user's User object from Redis cache
#
class MHVAccountsService
class MhvAccountsService
include SentryLogging

STATSD_ACCOUNT_EXISTED_KEY = 'mhv.account.existed'
Expand Down
2 changes: 1 addition & 1 deletion app/uploaders/supporting_evidence_attachment_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
class SupportingEvidenceAttachmentUploader < CarrierWave::Uploader::Base
include ValidateFileSize
include SetAwsConfig
include ValidatePDF
include ValidatePdf

MAX_FILE_SIZE = 25.megabytes

Expand Down
2 changes: 1 addition & 1 deletion app/uploaders/validate_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'origami'

module ValidatePDF
module ValidatePdf
extend ActiveSupport::Concern

included do
Expand Down
6 changes: 3 additions & 3 deletions app/workers/central_mail/submit_saved_claim_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def to_faraday_upload(file_path)

def process_record(record)
pdf_path = record.to_pdf
stamped_path1 = CentralMail::DatestampPDF.new(pdf_path).run(text: 'VA.GOV', x: 5, y: 5)
CentralMail::DatestampPDF.new(stamped_path1).run(
stamped_path1 = CentralMail::DatestampPdf.new(pdf_path).run(text: 'VA.GOV', x: 5, y: 5)
CentralMail::DatestampPdf.new(stamped_path1).run(
text: 'FDC Reviewed - va.gov Submission',
x: 429,
y: 770,
Expand All @@ -75,7 +75,7 @@ def process_record(record)
def get_hash_and_pages(file_path)
{
hash: Digest::SHA256.file(file_path).hexdigest,
pages: PDFInfo::Metadata.read(file_path).pages
pages: PdfInfo::Metadata.read(file_path).pages
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ def data
private

# Invokes Filler ancillary form method to generate PDF document
# Then calls method CentralMail::DatestampPDF to stamp the document.
# Then calls method CentralMail::DatestampPdf to stamp the document.
# Its called twice, once to stamp with text "VA.gov YYYY-MM-DD" at the bottom of each page
# and second time to stamp with text "VA.gov Submission" at the top of each page
def generate_stamp_pdf(form_content, submitted_claim_id, form_id)
pdf_path = PDFFill::Filler.fill_ancillary_form(form_content, submitted_claim_id, form_id)
stamped_path1 = CentralMail::DatestampPDF.new(pdf_path).run(text: 'VA.gov', x: 5, y: 5)
CentralMail::DatestampPDF.new(stamped_path1).run(
pdf_path = PdfFill::Filler.fill_ancillary_form(form_content, submitted_claim_id, form_id)
stamped_path1 = CentralMail::DatestampPdf.new(pdf_path).run(text: 'VA.gov', x: 5, y: 5)
CentralMail::DatestampPdf.new(stamped_path1).run(
text: 'VA.gov Submission',
x: 510,
y: 775,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ def process_0781(auth_headers, evss_claim_id, form_id, form_content)
end

# Invokes Filler ancillary form method to generate PDF document
# Then calls method CentralMail::DatestampPDF to stamp the document.
# Then calls method CentralMail::DatestampPdf to stamp the document.
# Its called twice, once to stamp with text "VA.gov YYYY-MM-DD" at the bottom of each page
# and second time to stamp with text "VA.gov Submission" at the top of each page
def generate_stamp_pdf(form_content, evss_claim_id, form_id)
pdf_path = PDFFill::Filler.fill_ancillary_form(form_content, evss_claim_id, form_id)
stamped_path = CentralMail::DatestampPDF.new(pdf_path).run(text: 'VA.gov', x: 5, y: 5)
CentralMail::DatestampPDF.new(stamped_path).run(
pdf_path = PdfFill::Filler.fill_ancillary_form(form_content, evss_claim_id, form_id)
stamped_path = CentralMail::DatestampPdf.new(pdf_path).run(text: 'VA.gov', x: 5, y: 5)
CentralMail::DatestampPdf.new(stamped_path).run(
text: 'VA.gov Submission',
x: 510,
y: 775,
Expand Down
36 changes: 18 additions & 18 deletions app/workers/mhv/account_statistics_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,29 @@ def stats

def historic_stats
{
'mhv.account.created_count' => MHVAccount.historic.created.count,
'mhv.account.existing_premium_count' => MHVAccount.historic.existing_premium.count,
'mhv.account.existing_upgraded_count' => MHVAccount.historic.existing_upgraded.count,
'mhv.account.existing_failed_upgrade_count' => MHVAccount.historic.existing_failed_upgrade.count,
'mhv.account.created_premium_count' => MHVAccount.historic.created_premium.count,
'mhv.account.created_failed_upgrade_count' => MHVAccount.historic.created_failed_upgrade.count,
'mhv.account.created_and_upgraded_count' => MHVAccount.historic.created_and_upgraded.count,
'mhv.account.failed_create_count' => MHVAccount.historic.failed_create.count,
'mhv.account.total_count' => MHVAccount.historic.count
'mhv.account.created_count' => MhvAccount.historic.created.count,
'mhv.account.existing_premium_count' => MhvAccount.historic.existing_premium.count,
'mhv.account.existing_upgraded_count' => MhvAccount.historic.existing_upgraded.count,
'mhv.account.existing_failed_upgrade_count' => MhvAccount.historic.existing_failed_upgrade.count,
'mhv.account.created_premium_count' => MhvAccount.historic.created_premium.count,
'mhv.account.created_failed_upgrade_count' => MhvAccount.historic.created_failed_upgrade.count,
'mhv.account.created_and_upgraded_count' => MhvAccount.historic.created_and_upgraded.count,
'mhv.account.failed_create_count' => MhvAccount.historic.failed_create.count,
'mhv.account.total_count' => MhvAccount.historic.count
}
end

def active_stats
{
'mhv.account.active.created_count' => MHVAccount.active.created.count,
'mhv.account.active.existing_premium_count' => MHVAccount.active.existing_premium.count,
'mhv.account.active.existing_upgraded_count' => MHVAccount.active.existing_upgraded.count,
'mhv.account.active.existing_failed_upgrade_count' => MHVAccount.active.existing_failed_upgrade.count,
'mhv.account.active.created_premium_count' => MHVAccount.active.created_premium.count,
'mhv.account.active.created_failed_upgrade_count' => MHVAccount.active.created_failed_upgrade.count,
'mhv.account.active.created_and_upgraded_count' => MHVAccount.active.created_and_upgraded.count,
'mhv.account.active.failed_create_count' => MHVAccount.active.failed_create.count,
'mhv.account.active.total_count' => MHVAccount.active.count
'mhv.account.active.created_count' => MhvAccount.active.created.count,
'mhv.account.active.existing_premium_count' => MhvAccount.active.existing_premium.count,
'mhv.account.active.existing_upgraded_count' => MhvAccount.active.existing_upgraded.count,
'mhv.account.active.existing_failed_upgrade_count' => MhvAccount.active.existing_failed_upgrade.count,
'mhv.account.active.created_premium_count' => MhvAccount.active.created_premium.count,
'mhv.account.active.created_failed_upgrade_count' => MhvAccount.active.created_failed_upgrade.count,
'mhv.account.active.created_and_upgraded_count' => MhvAccount.active.created_and_upgraded.count,
'mhv.account.active.failed_create_count' => MhvAccount.active.failed_create.count,
'mhv.account.active.total_count' => MhvAccount.active.count
}
end
end
Expand Down
7 changes: 0 additions & 7 deletions config/initializers/inflections.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@
inflect.acronym 'GIDS'
inflect.acronym 'GI'
inflect.acronym 'IHub'
inflect.acronym 'JWT'
inflect.acronym 'MDOT'
inflect.acronym 'MHV'
inflect.acronym 'NCA'
inflect.acronym 'PagerDuty'
inflect.acronym 'PCIU'
inflect.acronym 'PDF'
inflect.acronym 'PPIU'
inflect.acronym 'PPMS'
inflect.acronym 'PSSG'
Expand All @@ -30,8 +25,6 @@
inflect.acronym 'SSOe'
inflect.acronym 'SSO'
inflect.acronym 'VAOS'
inflect.acronym 'VAR' # an older term for what is now VAOS
inflect.acronym 'VA'
inflect.acronym 'VBA'
inflect.acronym 'VC'
inflect.acronym 'VHA'
Expand Down
4 changes: 2 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,9 @@
mount VBADocuments::Engine, at: '/vba_documents'
mount AppealsApi::Engine, at: '/appeals'
mount ClaimsApi::Engine, at: '/claims'
mount VAFacilities::Engine, at: '/va_facilities'
mount VaFacilities::Engine, at: '/va_facilities'
mount Veteran::Engine, at: '/veteran'
mount VAForms::Engine, at: '/va_forms'
mount VaForms::Engine, at: '/va_forms'
mount VeteranVerification::Engine, at: '/veteran_verification'
mount VeteranConfirmation::Engine, at: '/veteran_confirmation'
end
Expand Down
4 changes: 2 additions & 2 deletions config/sidekiq_scheduler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ ExternalServicesStatusJob:
every: '1m'
description: "Checks the current status of all external services through PagerDuty's API"

VAForms::FetchLatest:
VaForms::FetchLatest:
cron: "0 0 * * * America/New_York"
class: VAForms::FormReloader
class: VaForms::FormReloader
description: "Fetches latest VA Forms"
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def change
# accounts can be disabled, new ones could be created
# it is entirely feasible to have more than one mhv account created by vets.gov
# if a previously created or upgraded one has since been disabled.
# it's also entirely feasible for Mhv to recycle existing mhv_correlation_ids
# it's also entirely feasible for MHV to recycle existing mhv_correlation_ids
# so no uniqueness constraints can exist here.

# first we will drop the index
Expand Down
4 changes: 2 additions & 2 deletions lib/central_mail/datestamp_pdf.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module CentralMail
class DatestampPDF
class DatestampPdf
def initialize(file_path, append_to_stamp: nil)
@file_path = file_path
@append_to_stamp = append_to_stamp
Expand Down Expand Up @@ -31,7 +31,7 @@ def generate_stamp(stamp_path, text, x, y, text_only)

def stamp(file_path, stamp_path)
out_path = "#{Common::FileHelpers.random_file_path}.pdf"
PDFFill::Filler::PDF_FORMS.stamp(file_path, stamp_path, out_path)
PdfFill::Filler::PDF_FORMS.stamp(file_path, stamp_path, out_path)
File.delete(file_path)
out_path
rescue
Expand Down
Loading

0 comments on commit d90e249

Please sign in to comment.