enju_event 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +1 -1
- data/Rakefile +10 -0
- data/app/models/event.rb +3 -0
- data/app/models/event_category.rb +1 -0
- data/app/models/event_import_file.rb +9 -4
- data/app/models/event_import_result.rb +1 -0
- data/app/models/participate.rb +1 -0
- data/lib/enju_event/engine.rb +1 -1
- data/lib/enju_event/version.rb +1 -1
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/private/system/event_import_files/event_imports/000/000/001/original/event_import_file_sample1.tsv +5 -0
- data/spec/dummy/private/system/event_import_files/event_imports/000/000/001/original/event_import_file_sample2.tsv +3 -0
- data/spec/dummy/solr/data/test/index/_2s.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_2s.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_2s.fnm +4 -0
- data/spec/dummy/solr/data/test/index/_2s.frq +0 -0
- data/spec/dummy/solr/data/test/index/_2s.nrm +1 -0
- data/spec/dummy/solr/data/test/index/_2s.prx +0 -0
- data/spec/dummy/solr/data/test/index/_2s.tii +0 -0
- data/spec/dummy/solr/data/test/index/_2s.tis +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_2k +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- metadata +26 -4
- data/spec/dummy/solr/data/test/index/segments_1 +0 -0
data/MIT-LICENSE
CHANGED
data/Rakefile
CHANGED
@@ -29,8 +29,18 @@ Bundler::GemHelper.install_tasks
|
|
29
29
|
require 'rspec/core'
|
30
30
|
require 'rspec/core/rake_task'
|
31
31
|
|
32
|
+
require 'rake/testtask'
|
33
|
+
|
34
|
+
Rake::TestTask.new(:test) do |t|
|
35
|
+
t.libs << 'lib'
|
36
|
+
t.libs << 'test'
|
37
|
+
t.pattern = 'test/**/*_test.rb'
|
38
|
+
t.verbose = false
|
39
|
+
end
|
40
|
+
|
32
41
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
33
42
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
34
43
|
end
|
35
44
|
|
45
|
+
|
36
46
|
task :default => :spec
|
data/app/models/event.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
class Event < ActiveRecord::Base
|
3
|
+
attr_accessible :library_id, :event_category_id, :name, :note, :start_at,
|
4
|
+
:event_at, :all_day, :display_name
|
5
|
+
|
3
6
|
scope :closing_days, includes(:event_category).where('event_categories.name = ?', 'closed')
|
4
7
|
scope :on, lambda {|datetime| where('start_at >= ? AND start_at < ?', datetime.beginning_of_day, datetime.tomorrow.beginning_of_day + 1)}
|
5
8
|
scope :past, lambda {|datetime| where('end_at <= ?', Time.zone.parse(datetime).beginning_of_day)}
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class EventImportFile < ActiveRecord::Base
|
2
|
+
attr_accessible :event_import
|
2
3
|
include ImportFile
|
3
4
|
default_scope :order => 'id DESC'
|
4
5
|
scope :not_imported, where(:state => 'pending')
|
@@ -62,7 +63,9 @@ class EventImportFile < ActiveRecord::Base
|
|
62
63
|
|
63
64
|
rows.each do |row|
|
64
65
|
next if row['dummy'].to_s.strip.present?
|
65
|
-
|
66
|
+
event_import_result = EventImportResult.new
|
67
|
+
event_import_result.assign_attributes({:event_import_file_id => self.id, :body => row.fields.join("\t")}, :as => :admin)
|
68
|
+
event_import_result.save!
|
66
69
|
|
67
70
|
event = Event.new
|
68
71
|
event.name = row['name'].to_s.strip
|
@@ -82,14 +85,14 @@ class EventImportFile < ActiveRecord::Base
|
|
82
85
|
event.event_category = event_category
|
83
86
|
|
84
87
|
if event.save!
|
85
|
-
|
88
|
+
event_import_result.event = event
|
86
89
|
num[:imported] += 1
|
87
90
|
if row_num % 50 == 0
|
88
91
|
Sunspot.commit
|
89
92
|
GC.start
|
90
93
|
end
|
91
94
|
end
|
92
|
-
|
95
|
+
event_import_result.save!
|
93
96
|
row_num += 1
|
94
97
|
end
|
95
98
|
Sunspot.commit
|
@@ -185,7 +188,9 @@ class EventImportFile < ActiveRecord::Base
|
|
185
188
|
header = file.first
|
186
189
|
rows = FasterCSV.open(tempfile.path, :headers => header, :col_sep => "\t")
|
187
190
|
end
|
188
|
-
|
191
|
+
event_import_result = EventImportResult.new
|
192
|
+
event_import_result.assign_attributes({:event_import_file_id => self.id, :body => header.join("\t")}, :as => :admin)
|
193
|
+
event_import_result.save!
|
189
194
|
tempfile.close(true)
|
190
195
|
file.close
|
191
196
|
rows
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class EventImportResult < ActiveRecord::Base
|
2
|
+
attr_accessible :event_id, :event_import_file_id, :body, :as => :admin
|
2
3
|
default_scope :order => 'event_import_results.id'
|
3
4
|
scope :file_id, proc{|file_id| {:conditions => {:event_import_file_id => file_id}}}
|
4
5
|
scope :failed, where(:event_id => nil)
|
data/app/models/participate.rb
CHANGED
data/lib/enju_event/engine.rb
CHANGED
data/lib/enju_event/version.rb
CHANGED
Binary file
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
NRM�xxvx|u|||||||||||||||||||||||||�|ut�u��|||||
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enju_event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -477,6 +477,7 @@ files:
|
|
477
477
|
- spec/dummy/config/locales/en.yml
|
478
478
|
- spec/dummy/config/routes.rb
|
479
479
|
- spec/dummy/config.ru
|
480
|
+
- spec/dummy/db/development.sqlite3
|
480
481
|
- spec/dummy/db/migrate/001_create_patrons.rb
|
481
482
|
- spec/dummy/db/migrate/059_create_libraries.rb
|
482
483
|
- spec/dummy/db/migrate/069_create_shelves.rb
|
@@ -503,6 +504,8 @@ files:
|
|
503
504
|
- spec/dummy/lib/enju_leaf/master_model.rb
|
504
505
|
- spec/dummy/lib/enju_leaf/url_validator.rb
|
505
506
|
- spec/dummy/lib/enju_leaf.rb
|
507
|
+
- spec/dummy/private/system/event_import_files/event_imports/000/000/001/original/event_import_file_sample1.tsv
|
508
|
+
- spec/dummy/private/system/event_import_files/event_imports/000/000/001/original/event_import_file_sample2.tsv
|
506
509
|
- spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_destroy_file.tsv
|
507
510
|
- spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_import_file_sample1.tsv
|
508
511
|
- spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_import_file_sample2.tsv
|
@@ -527,8 +530,16 @@ files:
|
|
527
530
|
- spec/dummy/solr/conf/spellings.txt
|
528
531
|
- spec/dummy/solr/conf/stopwords.txt
|
529
532
|
- spec/dummy/solr/conf/synonyms.txt
|
533
|
+
- spec/dummy/solr/data/test/index/_2s.fdt
|
534
|
+
- spec/dummy/solr/data/test/index/_2s.fdx
|
535
|
+
- spec/dummy/solr/data/test/index/_2s.fnm
|
536
|
+
- spec/dummy/solr/data/test/index/_2s.frq
|
537
|
+
- spec/dummy/solr/data/test/index/_2s.nrm
|
538
|
+
- spec/dummy/solr/data/test/index/_2s.prx
|
539
|
+
- spec/dummy/solr/data/test/index/_2s.tii
|
540
|
+
- spec/dummy/solr/data/test/index/_2s.tis
|
530
541
|
- spec/dummy/solr/data/test/index/segments.gen
|
531
|
-
- spec/dummy/solr/data/test/index/
|
542
|
+
- spec/dummy/solr/data/test/index/segments_2k
|
532
543
|
- spec/dummy/solr/data/test/spellchecker/segments.gen
|
533
544
|
- spec/dummy/solr/data/test/spellchecker/segments_1
|
534
545
|
- spec/factories/country.rb
|
@@ -633,6 +644,7 @@ test_files:
|
|
633
644
|
- spec/dummy/config/locales/en.yml
|
634
645
|
- spec/dummy/config/routes.rb
|
635
646
|
- spec/dummy/config.ru
|
647
|
+
- spec/dummy/db/development.sqlite3
|
636
648
|
- spec/dummy/db/migrate/001_create_patrons.rb
|
637
649
|
- spec/dummy/db/migrate/059_create_libraries.rb
|
638
650
|
- spec/dummy/db/migrate/069_create_shelves.rb
|
@@ -659,6 +671,8 @@ test_files:
|
|
659
671
|
- spec/dummy/lib/enju_leaf/master_model.rb
|
660
672
|
- spec/dummy/lib/enju_leaf/url_validator.rb
|
661
673
|
- spec/dummy/lib/enju_leaf.rb
|
674
|
+
- spec/dummy/private/system/event_import_files/event_imports/000/000/001/original/event_import_file_sample1.tsv
|
675
|
+
- spec/dummy/private/system/event_import_files/event_imports/000/000/001/original/event_import_file_sample2.tsv
|
662
676
|
- spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_destroy_file.tsv
|
663
677
|
- spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_import_file_sample1.tsv
|
664
678
|
- spec/dummy/private/system/event_import_files/event_imports/000/000/004/original/event_import_file_sample2.tsv
|
@@ -683,8 +697,16 @@ test_files:
|
|
683
697
|
- spec/dummy/solr/conf/spellings.txt
|
684
698
|
- spec/dummy/solr/conf/stopwords.txt
|
685
699
|
- spec/dummy/solr/conf/synonyms.txt
|
700
|
+
- spec/dummy/solr/data/test/index/_2s.fdt
|
701
|
+
- spec/dummy/solr/data/test/index/_2s.fdx
|
702
|
+
- spec/dummy/solr/data/test/index/_2s.fnm
|
703
|
+
- spec/dummy/solr/data/test/index/_2s.frq
|
704
|
+
- spec/dummy/solr/data/test/index/_2s.nrm
|
705
|
+
- spec/dummy/solr/data/test/index/_2s.prx
|
706
|
+
- spec/dummy/solr/data/test/index/_2s.tii
|
707
|
+
- spec/dummy/solr/data/test/index/_2s.tis
|
686
708
|
- spec/dummy/solr/data/test/index/segments.gen
|
687
|
-
- spec/dummy/solr/data/test/index/
|
709
|
+
- spec/dummy/solr/data/test/index/segments_2k
|
688
710
|
- spec/dummy/solr/data/test/spellchecker/segments.gen
|
689
711
|
- spec/dummy/solr/data/test/spellchecker/segments_1
|
690
712
|
- spec/factories/country.rb
|
Binary file
|