app/models/digital_asset.rb in daengine-0.4.7.3 vs app/models/digital_asset.rb in daengine-0.4.7.5
- old
+ new
@@ -2,11 +2,10 @@
class DigitalAsset
include Mongoid::Document
include Mongoid::Timestamps
-
field :title, type: String
field :changed_at, type: Time
field :audiences, type: Array, default: []
field :sami_code, type: String
field :product_ids, type: Array, default: []
@@ -53,10 +52,11 @@
scope :orderable, -> {where(orderable: true)}
scope :has_finra, -> {where(:'documents.content_type' => ContentType::FINRA)}
scope :audience_in, ->(audience) {where(:audiences.in => audience)}
scope :alphabetical, order_by(:title => :asc)
scope :not_xbrl, -> {excludes(:'documents.content_type' => ContentType::XBRL_DOCUMENT)}
+
#scope :order_by_fund, order_by[[:product_ids, :asc]]
#default_scope {not_in(:'documents.content_type' => ["LDJDCMAIK"])}
# validations
validates_presence_of :guid, :title, :changed_at, :published_at,
@@ -216,11 +216,39 @@
BUSINESS_CALENDAR = 'MA540I7SX'
WEEKLY_HOLDINGS = 'MA542HDIJ'
FUND_DOCUMENTS = '528'
FORMS_AND_APPLICATIONS = '496'
XBRL_DOCUMENT = 'LDJDCMAIK'
+
+ FUND_DOC_TYPES = [DAILY_HOLDINGS, WEEKLY_HOLDINGS, MONTHLY_HOLDINGS, COMMENTARY,FACTSHEET,
+ PROSPECTUS,SUMMARY_PROSPECTUS,ANNUAL_REPORT,SEMIANNUAL_REPORT,SAI,BUSINESS_CALENDAR,FUND_YIELD,
+ L_SHARE_YIELD_SHEET, P_SHARE_YIELD_SHEET
+ ]
end
class DigitalAsset::Audience
INVESTOR_APPROVED = '490'
INSTITUTIONAL_USE = '491'
end
+
+
+FUND_DOC_ORDER = {
+ :daily_holdings => [DigitalAsset::ContentType::DAILY_HOLDINGS],
+ :weekly_holdings => [DigitalAsset::ContentType::WEEKLY_HOLDINGS],
+ :current_monthly_holdings => [
+ DigitalAsset::ContentType::MONTHLY_HOLDINGS,
+ lambda {|docs| docs[0] ? [docs[0]] : [] }
+ ],
+ :commentary => [DigitalAsset::ContentType::COMMENTARY],
+ :factsheet => [DigitalAsset::ContentType::FACTSHEET],
+ :prospectus => [DigitalAsset::ContentType::PROSPECTUS],
+ :summary_prospectus => [DigitalAsset::ContentType::SUMMARY_PROSPECTUS],
+ :annual_report => [DigitalAsset::ContentType::ANNUAL_REPORT],
+ :semiannual_report => [DigitalAsset::ContentType::SEMIANNUAL_REPORT],
+ :sai => [DigitalAsset::ContentType::SAI],
+ :business_calendar => [DigitalAsset::ContentType::BUSINESS_CALENDAR],
+ :prior_monthly_holdings => [
+ DigitalAsset::ContentType::MONTHLY_HOLDINGS,
+ lambda {|docs| docs }
+ ],
+ :fund_yield => [DigitalAsset::ContentType::FUND_YIELD]
+ }