daengine 0.4.0.0 → 0.4.0.1
Sign up to get free protection for your applications and to get access to all the features.
data/app/models/digital_asset.rb
CHANGED
@@ -30,6 +30,7 @@ class DigitalAsset
|
|
30
30
|
|
31
31
|
accepts_nested_attributes_for :documents
|
32
32
|
|
33
|
+
default_scope not_in(:'documents.content_type' => [ContentType::XBRL_DOCUMENT])
|
33
34
|
scope :title_is, ->(title) { where(:title => title)}
|
34
35
|
scope :business_owner_is, ->(business_owner) { where(:business_owner => business_owner)}
|
35
36
|
scope :guid_is, ->(guid) { where(:guid => guid)}
|
@@ -48,6 +49,7 @@ class DigitalAsset
|
|
48
49
|
scope :has_finra, -> {where(:'documents.content_type' => ContentType::FINRA)}
|
49
50
|
scope :audience_in, ->(audience) {where(:audiences.in => audience)}
|
50
51
|
scope :alphabetical, order_by(:title => :asc)
|
52
|
+
#scope :not_xbrl, -> {excludes(:'documents.content_type' => ContentType::XBRL_DOCUMENT)}
|
51
53
|
# scope :order_by_fund, order_by[[:product_ids, :asc]]
|
52
54
|
|
53
55
|
# validations
|
@@ -82,7 +82,6 @@ module Daengine::TeamsiteMetadataParser
|
|
82
82
|
update_count = 0; delete_count = 0; added_count = 0;
|
83
83
|
assets.keys.each do |key|
|
84
84
|
da = nil
|
85
|
-
asset_doc = assets[key]['documents_attributes'].first if (!assets[key]['documents_attributes'].empty?)
|
86
85
|
begin
|
87
86
|
if (!assets[key]['unpublished_at'].nil?)
|
88
87
|
DigitalAsset.where(guid: key).try :delete_all
|
@@ -90,10 +89,6 @@ module Daengine::TeamsiteMetadataParser
|
|
90
89
|
elsif (assets[key]['expires_at'].nil? || (assets[key]['expires_at'] < 1.minute.from_now))
|
91
90
|
DigitalAsset.where(guid: key).try :delete_all
|
92
91
|
delete_count += 1
|
93
|
-
elsif (asset_doc['content_type'] == DigitalAsset::ContentType::XBRL_DOCUMENT)
|
94
|
-
Daengine.log("Removing XBRL Document", "info")
|
95
|
-
DigitalAsset.where(guid: key).try :delete_all
|
96
|
-
delete_count += 1
|
97
92
|
else
|
98
93
|
da = DigitalAsset.find_or_initialize_by(guid: key)
|
99
94
|
asset_docs = trim_package(assets[key]['documents_attributes'], last_read, da)
|
data/lib/daengine/version.rb
CHANGED