Usptream sync

This commit is contained in:
Senad Uka
2020-07-20 13:28:40 +00:00
parent add8304eab
commit 40f241b75f
74 changed files with 12779 additions and 71 deletions

View File

@@ -10,6 +10,7 @@ class AcquiredMediaRelease < ApplicationRecord
include Syncable
include PersonName
include CsvExportable
include Approvable
class << self
def custom_csv_exportable_headers

View File

@@ -16,6 +16,7 @@ class AppearanceRelease < ApplicationRecord
include GuardianName
include SecondGuardianName
include CsvExportable
include Approvable
class << self
def custom_csv_exportable_headers

View File

@@ -0,0 +1,17 @@
module Approvable
extend ActiveSupport::Concern
included do
def approve_by(user)
return unless approved_at.nil?
self.approved_by_user_name = user.full_name
self.approved_by_user_email = user.email
self.approved_at = Time.zone.now
end
def approved?
self.approved_at.present?
end
end
end

View File

@@ -3,7 +3,7 @@
module CsvExportable
extend ActiveSupport::Concern
COMMON_HEADERS = %i[notes tags signed_at].freeze
COMMON_HEADERS = %i[approved? notes tags signed_at].freeze
COMMON_VALUES = %w[clean_notes clean_tags signed_on].freeze
included do

View File

@@ -11,6 +11,7 @@ class LocationRelease < ApplicationRecord
include Taggable
include PersonName
include CsvExportable
include Approvable
class << self
def custom_csv_exportable_headers

View File

@@ -11,6 +11,7 @@ class MaterialRelease < ApplicationRecord
include Taggable
include PersonName
include CsvExportable
include Approvable
class << self
def custom_csv_exportable_headers

View File

@@ -12,10 +12,11 @@ class MedicalRelease < ApplicationRecord
include GuardianName
include SecondGuardianName
include CsvExportable
include Approvable
class << self
def custom_csv_exportable_headers
%i[approved? name contact_info]
%i[name contact_info]
end
end
@@ -107,18 +108,6 @@ class MedicalRelease < ApplicationRecord
"#{project.name.parameterize}_#{contract_template.release_type}_#{(signed_at || created_at).strftime("%Y.%m.%d")}_#{release_number}_#{filename_suffix.parameterize}"
end
def approve_by(user)
return unless approved_at.nil?
self.approved_by_user_name = user.full_name
self.approved_by_user_email = user.email
self.approved_at = Time.zone.now
end
def approved?
approved_at.present?
end
private
def valid_answers

View File

@@ -10,6 +10,7 @@ class MiscRelease < ApplicationRecord
include GuardianName
include GuardianPhotoable
include CsvExportable
include Approvable
class << self
def custom_csv_exportable_headers

View File

@@ -8,6 +8,7 @@ class MusicRelease < ApplicationRecord
include Taggable
include PersonName
include CsvExportable
include Approvable
class << self
def custom_csv_exportable_headers

View File

@@ -13,6 +13,18 @@ class QrCode
new(url, "#{filename}.png")
end
def self.build_from_multiple_contract_templates(contract_templates, project)
account = project.account
locale = I18n.locale
host = AppHost.new.domain_with_port
route = [account, project, :contract_templates, contract_template_ids: contract_templates.ids, locale: I18n.locale, host: AppHost.new.domain_with_port]
url = Rails.application.routes.url_helpers.url_for(route)
filename = [project.account.name, project.name].map(&:parameterize).join("_")
new(url, "#{filename}.png")
end
def initialize(url, filename = "qrcode.png")
@url = url
@filename = filename

View File

@@ -15,6 +15,7 @@ class TalentRelease < ApplicationRecord
include GuardianName
include SecondGuardianName
include CsvExportable
include Approvable
class << self
def custom_csv_exportable_headers

View File

@@ -6,5 +6,5 @@ class TaskRequest < ApplicationRecord
scope :order_by_recent, -> { order(created_at: :desc) }
validates :time_allowed, numericality: { only_integer: true, greater_than_or_equal_to: 2 }
validates :time_allowed, numericality: { only_integer: true, greater_than_or_equal_to: 2 }, allow_blank: true
end