acts_as_working_days 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +63 -6
- data/acts_as_working_days-0.0.1.gem +0 -0
- data/acts_as_working_days-0.0.3.gem +0 -0
- data/acts_as_working_days.gemspec +10 -7
- data/generators/acts_as_working_days_migration/acts_as_working_days_migration_generator.rb +7 -0
- data/generators/acts_as_working_days_migration/templates/migration.rb +25 -0
- data/lib/acts_as_working_days.rb +12 -7
- data/lib/generators/acts_as_working_days/migration/templates/active_record/migration.rb +3 -3
- metadata +6 -5
- data/test/acts_as_working_days_plugin.sqlite3.db +0 -0
- data/test/debug.log +0 -161
data/README.rdoc
CHANGED
@@ -1,13 +1,70 @@
|
|
1
|
-
ActsAsWorkingDays
|
2
|
-
================
|
1
|
+
= ActsAsWorkingDays
|
3
2
|
|
4
|
-
|
3
|
+
acts_as_working_days is a Rails plugin to add working days on models
|
5
4
|
|
5
|
+
== Usage
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
class Company < ActiveRecord::Base
|
8
|
+
|
9
|
+
acts_as_working_days
|
9
10
|
|
10
|
-
|
11
|
+
end
|
12
|
+
|
13
|
+
#Sample test code
|
14
|
+
def test_working_day
|
11
15
|
|
16
|
+
kwik_e_mart = Company.new(:name => 'Kwik-E-Mart')
|
17
|
+
|
18
|
+
#1 is Monday - Apu Kwik-E-Mart is only opened on Mondays, start 8h30, end 18h45
|
19
|
+
kwik_e_mart.put_working_day(:week_day => 1, :start_hour => 8, :start_min => 30, :end_hour => 18, :end_min => 45)
|
20
|
+
|
21
|
+
#Save model and working day
|
22
|
+
kwik_e_mart.save
|
23
|
+
|
24
|
+
#0 is Sunday - 12h45 is closed
|
25
|
+
assert_equal false, kwik_e_mart.working_day?(:week_day => 0, :hour => 12, :min => 0)
|
26
|
+
|
27
|
+
#1 is Monday - 21h00 is closed
|
28
|
+
assert_equal false, kwik_e_mart.working_day?(:week_day => 1, :hour => 21)
|
29
|
+
|
30
|
+
#1 is Monday - 12h15 is opened
|
31
|
+
assert_equal true, kwik_e_mart.working_day?(:week_day => 1, :hour => 12, :min => 15)
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
== Installation
|
37
|
+
|
38
|
+
=== Rails 2.3.x
|
39
|
+
|
40
|
+
Acts As Working Days On is tested to work in Rails 2.3.5.
|
41
|
+
|
42
|
+
==== Plugin
|
43
|
+
|
44
|
+
script/plugin install git://github.com/phstc/acts_as_working_days
|
45
|
+
|
46
|
+
==== Post Installation
|
47
|
+
|
48
|
+
1. script/generate acts_as_working_days_migration
|
49
|
+
2. rake db:migrate
|
50
|
+
|
51
|
+
=== Rails 3.0
|
52
|
+
|
53
|
+
Acts As Working Days On is tested to work in Rails 2.3.5.
|
54
|
+
|
55
|
+
To use it, add it to your Gemfile:
|
56
|
+
|
57
|
+
gem 'acts_as_working_days'
|
58
|
+
|
59
|
+
==== Post Installation
|
60
|
+
|
61
|
+
1. rails generate acts_as_working_days:migration
|
62
|
+
2. rake db:migrate
|
63
|
+
|
64
|
+
== Testing
|
65
|
+
|
66
|
+
Inside the plugin directory, you can run the tests with:
|
67
|
+
|
68
|
+
rake test
|
12
69
|
|
13
70
|
Copyright (c) 2010 Pablo Cantero, released under the MIT license
|
Binary file
|
Binary file
|
@@ -1,3 +1,6 @@
|
|
1
|
+
#gem build acts_as_working_days.gemspec
|
2
|
+
#gem push acts_as_working_days-0.0.1.gem
|
3
|
+
|
1
4
|
require 'rake/gempackagetask'
|
2
5
|
|
3
6
|
PKG_FILES = FileList[
|
@@ -8,10 +11,10 @@ PKG_FILES = FileList[
|
|
8
11
|
'tasks/**/*',
|
9
12
|
'test/**/*'
|
10
13
|
]
|
11
|
-
|
14
|
+
|
12
15
|
spec = Gem::Specification.new do |s|
|
13
16
|
s.name = "acts_as_working_days"
|
14
|
-
s.version = "0.0.
|
17
|
+
s.version = "0.0.4"
|
15
18
|
s.author = "Pablo Cantero"
|
16
19
|
s.email = "pablo@pablocantero.com"
|
17
20
|
s.homepage = "http://pablocantero.com/"
|
@@ -22,8 +25,8 @@ spec = Gem::Specification.new do |s|
|
|
22
25
|
s.has_rdoc = false
|
23
26
|
s.extra_rdoc_files = ["README.rdoc"]
|
24
27
|
end
|
25
|
-
|
26
|
-
desc 'Turn this plugin into a gem.'
|
27
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
28
|
-
pkg.gem_spec = spec
|
29
|
-
end
|
28
|
+
|
29
|
+
#desc 'Turn this plugin into a gem.'
|
30
|
+
#Rake::GemPackageTask.new(spec) do |pkg|
|
31
|
+
# pkg.gem_spec = spec
|
32
|
+
#end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class ActsAsWorkingDaysMigration < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
create_table :working_days, :force => true do |t|
|
5
|
+
#Date time columns
|
6
|
+
t.integer :week_day
|
7
|
+
t.integer :start_hour
|
8
|
+
t.integer :start_min
|
9
|
+
t.integer :end_hour
|
10
|
+
t.integer :end_min
|
11
|
+
#Polymorphic columns
|
12
|
+
t.integer :workable_id
|
13
|
+
t.string :workable_type
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
add_index :working_days, [:workable_id, :workable_type]
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.down
|
21
|
+
drop_table :working_days
|
22
|
+
remove_index :working_days, [:workable_id, :workable_type]
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/lib/acts_as_working_days.rb
CHANGED
@@ -14,13 +14,18 @@ module ActsAsWorkingDays
|
|
14
14
|
|
15
15
|
module InstanceMethods
|
16
16
|
def working_day?(params ={:week_day => Time.now.wday, :hour => Time.now.hour, :min => Time.now.min })
|
17
|
-
result =
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
result = nil
|
18
|
+
where = 'week_day = :week_day AND ((start_hour < :hour) OR (start_hour = :hour AND start_min <= :min)) AND ((end_hour > :hour) OR (end_hour = :hour AND end_min <= :min))'
|
19
|
+
params = {:week_day => params[:week_day], :hour => params[:hour], :min => params[:min]}
|
20
|
+
#To prevent @Depecrate
|
21
|
+
if working_days.respond_to?('where')
|
22
|
+
#Rails 3 style
|
23
|
+
result = working_days.where(where, params)
|
24
|
+
else
|
25
|
+
#Rails 2x style
|
26
|
+
result = working_days.find(:all, :conditions => [where, params])
|
27
|
+
end
|
28
|
+
return !result.empty?
|
24
29
|
end
|
25
30
|
|
26
31
|
def put_working_day(params = {:week_day => Time.now.wday, :start_hour => 0, :start_min => 0, :end_hour => 23, :end_min => 59})
|
@@ -14,12 +14,12 @@ class ActsAsWorkingDaysMigration < ActiveRecord::Migration
|
|
14
14
|
|
15
15
|
t.timestamps
|
16
16
|
end
|
17
|
+
add_index :working_days, [:workable_id, :workable_type]
|
17
18
|
end
|
18
|
-
|
19
|
-
add_index :working_days, [:workable_id, :workable_type]
|
20
|
-
|
19
|
+
|
21
20
|
def self.down
|
22
21
|
drop_table :working_days
|
22
|
+
remove_index :working_days, [:workable_id, :workable_type]
|
23
23
|
end
|
24
24
|
|
25
25
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_working_days
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pablo Cantero
|
@@ -29,6 +29,7 @@ extra_rdoc_files:
|
|
29
29
|
- README.rdoc
|
30
30
|
files:
|
31
31
|
- acts_as_working_days-0.0.1.gem
|
32
|
+
- acts_as_working_days-0.0.3.gem
|
32
33
|
- acts_as_working_days.gemspec
|
33
34
|
- init.rb
|
34
35
|
- install.rb
|
@@ -36,15 +37,15 @@ files:
|
|
36
37
|
- Rakefile
|
37
38
|
- README.rdoc
|
38
39
|
- uninstall.rb
|
40
|
+
- generators/acts_as_working_days_migration/acts_as_working_days_migration_generator.rb
|
41
|
+
- generators/acts_as_working_days_migration/templates/migration.rb
|
39
42
|
- lib/acts_as_working_days.rb
|
40
43
|
- lib/generators/acts_as_working_days/migration/migration_generator.rb
|
41
44
|
- lib/generators/acts_as_working_days/migration/templates/active_record/migration.rb
|
42
45
|
- lib/tasks/acts_as_working_days_tasks.rake
|
43
46
|
- rails/init.rb
|
44
|
-
- test/acts_as_working_days_plugin.sqlite3.db
|
45
47
|
- test/acts_as_working_days_test.rb
|
46
48
|
- test/database.yml
|
47
|
-
- test/debug.log
|
48
49
|
- test/schema.rb
|
49
50
|
- test/test_helper.rb
|
50
51
|
- test/working_day_test.rb
|
Binary file
|
data/test/debug.log
DELETED
@@ -1,161 +0,0 @@
|
|
1
|
-
# Logfile created on Fri Nov 19 18:17:34 -0200 2010 by logger.rb/22285
|
2
|
-
[1m[36mSQL (0.3ms)[0m [1mselect sqlite_version(*)[0m
|
3
|
-
[1m[35mSQL (0.4ms)[0m SELECT name
|
4
|
-
FROM sqlite_master
|
5
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
6
|
-
|
7
|
-
[1m[36mSQL (2.4ms)[0m [1mCREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) [0m
|
8
|
-
[1m[35mSQL (0.2ms)[0m SELECT name
|
9
|
-
FROM sqlite_master
|
10
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
11
|
-
|
12
|
-
[1m[36mSQL (1.3ms)[0m [1mCREATE TABLE "working_days" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "week_day" integer, "start_hour" integer, "start_min" integer, "end_hour" integer, "end_min" integer, "workable_id" integer, "workable_type" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
13
|
-
[1m[35mSQL (0.2ms)[0m SELECT name
|
14
|
-
FROM sqlite_master
|
15
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
16
|
-
|
17
|
-
[1m[36mSQL (1.2ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) [0m
|
18
|
-
[1m[35mSQL (0.1ms)[0m PRAGMA index_list("schema_migrations")
|
19
|
-
[1m[36mSQL (1.3ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
20
|
-
[1m[35mSQL (0.2ms)[0m SELECT name
|
21
|
-
FROM sqlite_master
|
22
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
23
|
-
|
24
|
-
[1m[36mSQL (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
25
|
-
[1m[35mSQL (1.0ms)[0m INSERT INTO "schema_migrations" (version) VALUES ('0')
|
26
|
-
[1m[36mSQL (0.1ms)[0m [1mselect sqlite_version(*)[0m
|
27
|
-
[1m[35mSQL (0.3ms)[0m SELECT name
|
28
|
-
FROM sqlite_master
|
29
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
30
|
-
|
31
|
-
[1m[36mSQL (2.0ms)[0m [1mDROP TABLE "companies"[0m
|
32
|
-
[1m[35mSQL (1.2ms)[0m CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
|
33
|
-
[1m[36mSQL (0.2ms)[0m [1m SELECT name
|
34
|
-
FROM sqlite_master
|
35
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
36
|
-
[0m
|
37
|
-
[1m[35mSQL (1.1ms)[0m DROP TABLE "working_days"
|
38
|
-
[1m[36mSQL (1.3ms)[0m [1mCREATE TABLE "working_days" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "week_day" integer, "start_hour" integer, "start_min" integer, "end_hour" integer, "end_min" integer, "workable_id" integer, "workable_type" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
39
|
-
[1m[35mSQL (0.2ms)[0m SELECT name
|
40
|
-
FROM sqlite_master
|
41
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
42
|
-
|
43
|
-
[1m[36mSQL (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
44
|
-
[1m[35mSQL (0.2ms)[0m SELECT name
|
45
|
-
FROM sqlite_master
|
46
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
47
|
-
|
48
|
-
[1m[36mSQL (0.1ms)[0m [1mDELETE FROM "companies" WHERE 1=1[0m
|
49
|
-
[1m[35mWorkingDay Load (0.1ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 1) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
|
50
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "companies" ("name") VALUES ('Kwik-E-Mart')[0m
|
51
|
-
[1m[35mWorkingDay Load (0.1ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 1) AND ("working_days"."workable_id" = 1) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
|
52
|
-
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:34.276908', 18, 45, 8, 30, '2010-11-19 20:17:34.276908', 1, 1, 'ActsAsWorkingDaysTest::Company')[0m
|
53
|
-
[1m[35mSQL (0.3ms)[0m SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 0 AND ((start_hour < 12) OR (start_hour = 12 AND start_min <= 0)) AND ((end_hour > 12) OR (end_hour = 12 AND end_min <= 0)))) AS subquery
|
54
|
-
[1m[36mSQL (0.3ms)[0m [1mSELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 1 AND ((start_hour < 21) OR (start_hour = 21 AND start_min <= NULL)) AND ((end_hour > 21) OR (end_hour = 21 AND end_min <= NULL)))) AS subquery[0m
|
55
|
-
[1m[35mSQL (0.2ms)[0m SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 1 AND ((start_hour < 7) OR (start_hour = 7 AND start_min <= 15)) AND ((end_hour > 7) OR (end_hour = 7 AND end_min <= 15)))) AS subquery
|
56
|
-
[1m[36mSQL (1.2ms)[0m [1mDELETE FROM "companies" WHERE 1=1[0m
|
57
|
-
[1m[35mWorkingDay Load (0.2ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
|
58
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "companies" ("name") VALUES ('Moes Tavern')[0m
|
59
|
-
[1m[35mWorkingDay Load (0.1ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 2) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
|
60
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:34.293433', 18, 45, 8, 30, '2010-11-19 20:17:34.293433', 0, 2, 'ActsAsWorkingDaysTest::Company')[0m
|
61
|
-
[1m[35mWorkingDay Load (0.2ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 2) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 2) LIMIT 1
|
62
|
-
[1m[36mSQL (0.3ms)[0m [1mUPDATE "working_days" SET "end_hour" = 19, "end_min" = 23, "start_hour" = 10, "start_min" = 13, "updated_at" = '2010-11-19 20:17:34.300106' WHERE ("working_days"."id" = 2)[0m
|
63
|
-
[1m[35mSQL (1.0ms)[0m DELETE FROM "companies" WHERE 1=1
|
64
|
-
[1m[36mWorkingDay Load (0.2ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1[0m
|
65
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "companies" ("name") VALUES ('The Leftorium')
|
66
|
-
[1m[36mWorkingDay Load (0.1ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 3) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1[0m
|
67
|
-
[1m[35mSQL (0.1ms)[0m INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:34.309800', 18, 45, 8, 30, '2010-11-19 20:17:34.309800', 0, 3, 'ActsAsWorkingDaysTest::Company')
|
68
|
-
[1m[36mSQL (1.2ms)[0m [1mDELETE FROM "companies" WHERE 1=1[0m
|
69
|
-
[1m[35mActsAsWorkingDaysTest::Company Load (0.1ms)[0m SELECT "companies".* FROM "companies"
|
70
|
-
[1m[36mSQL (0.1ms)[0m [1mDELETE FROM "companies" WHERE 1=1[0m
|
71
|
-
[1m[35mWorkingDay Load (0.1ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
|
72
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "companies" ("name") VALUES ('Moes Tavern')[0m
|
73
|
-
[1m[35mWorkingDay Load (0.1ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 4) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
|
74
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:34.320302', 18, 45, 8, 30, '2010-11-19 20:17:34.320302', 0, 4, 'ActsAsWorkingDaysTest::Company')[0m
|
75
|
-
[1m[35mSQL (0.2ms)[0m SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 4 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 0 AND ((start_hour < 12) OR (start_hour = 12 AND start_min <= NULL)) AND ((end_hour > 12) OR (end_hour = 12 AND end_min <= NULL)))) AS subquery
|
76
|
-
[1m[36mSQL (1.0ms)[0m [1mDELETE FROM "companies" WHERE 1=1[0m
|
77
|
-
[1m[35mWorkingDay Load (0.2ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
|
78
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:34.329076', 19, 30, 9, 15, '2010-11-19 20:17:34.329076', 0, NULL, 'ActsAsWorkingDaysTest::Company')[0m
|
79
|
-
[1m[35mWorkingDay Load (0.2ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1
|
80
|
-
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "companies" ("name") VALUES ('Springfield Nuclear Power Plant')[0m
|
81
|
-
[1m[35mWorkingDay Load (0.1ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 5) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1
|
82
|
-
[1m[36mSQL (0.1ms)[0m [1mUPDATE "working_days" SET "updated_at" = '2010-11-19 20:17:34.336563', "workable_id" = 5 WHERE ("working_days"."id" = 5)[0m
|
83
|
-
[1m[35mWorkingDay Load (0.2ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 5) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1
|
84
|
-
[1m[36mSQL (0.3ms)[0m [1mUPDATE "working_days" SET "end_hour" = 16, "end_min" = 15, "start_hour" = 6, "start_min" = 0, "updated_at" = '2010-11-19 20:17:34.341172' WHERE ("working_days"."id" = 5)[0m
|
85
|
-
[1m[36mSQL (0.2ms)[0m [1mselect sqlite_version(*)[0m
|
86
|
-
[1m[35mSQL (0.4ms)[0m SELECT name
|
87
|
-
FROM sqlite_master
|
88
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
89
|
-
|
90
|
-
[1m[36mSQL (2.6ms)[0m [1mDROP TABLE "companies"[0m
|
91
|
-
[1m[35mSQL (1.1ms)[0m CREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
|
92
|
-
[1m[36mSQL (0.2ms)[0m [1m SELECT name
|
93
|
-
FROM sqlite_master
|
94
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
95
|
-
[0m
|
96
|
-
[1m[35mSQL (1.1ms)[0m DROP TABLE "working_days"
|
97
|
-
[1m[36mSQL (1.3ms)[0m [1mCREATE TABLE "working_days" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "week_day" integer, "start_hour" integer, "start_min" integer, "end_hour" integer, "end_min" integer, "workable_id" integer, "workable_type" varchar(255), "created_at" datetime, "updated_at" datetime) [0m
|
98
|
-
[1m[35mSQL (0.2ms)[0m SELECT name
|
99
|
-
FROM sqlite_master
|
100
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
101
|
-
|
102
|
-
[1m[36mSQL (0.1ms)[0m [1mSELECT version FROM "schema_migrations"[0m
|
103
|
-
[1m[35mSQL (0.1ms)[0m select sqlite_version(*)
|
104
|
-
[1m[36mSQL (0.3ms)[0m [1m SELECT name
|
105
|
-
FROM sqlite_master
|
106
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
107
|
-
[0m
|
108
|
-
[1m[35mSQL (1.2ms)[0m DROP TABLE "companies"
|
109
|
-
[1m[36mSQL (1.0ms)[0m [1mCREATE TABLE "companies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255)) [0m
|
110
|
-
[1m[35mSQL (0.2ms)[0m SELECT name
|
111
|
-
FROM sqlite_master
|
112
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
113
|
-
|
114
|
-
[1m[36mSQL (1.4ms)[0m [1mDROP TABLE "working_days"[0m
|
115
|
-
[1m[35mSQL (1.5ms)[0m CREATE TABLE "working_days" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "week_day" integer, "start_hour" integer, "start_min" integer, "end_hour" integer, "end_min" integer, "workable_id" integer, "workable_type" varchar(255), "created_at" datetime, "updated_at" datetime)
|
116
|
-
[1m[36mSQL (0.4ms)[0m [1m SELECT name
|
117
|
-
FROM sqlite_master
|
118
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
119
|
-
[0m
|
120
|
-
[1m[35mSQL (0.1ms)[0m SELECT version FROM "schema_migrations"
|
121
|
-
[1m[36mSQL (0.2ms)[0m [1m SELECT name
|
122
|
-
FROM sqlite_master
|
123
|
-
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
|
124
|
-
[0m
|
125
|
-
[1m[35mSQL (0.1ms)[0m DELETE FROM "companies" WHERE 1=1
|
126
|
-
[1m[36mWorkingDay Load (0.1ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 1) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1[0m
|
127
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "companies" ("name") VALUES ('Kwik-E-Mart')
|
128
|
-
[1m[36mWorkingDay Load (0.1ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 1) AND ("working_days"."workable_id" = 1) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1[0m
|
129
|
-
[1m[35mSQL (0.1ms)[0m INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:39.252654', 18, 45, 8, 30, '2010-11-19 20:17:39.252654', 1, 1, 'ActsAsWorkingDaysTest::Company')
|
130
|
-
[1m[36mSQL (0.3ms)[0m [1mSELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 0 AND ((start_hour < 12) OR (start_hour = 12 AND start_min <= 0)) AND ((end_hour > 12) OR (end_hour = 12 AND end_min <= 0)))) AS subquery[0m
|
131
|
-
[1m[35mSQL (0.2ms)[0m SELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 1 AND ((start_hour < 21) OR (start_hour = 21 AND start_min <= NULL)) AND ((end_hour > 21) OR (end_hour = 21 AND end_min <= NULL)))) AS subquery
|
132
|
-
[1m[36mSQL (0.2ms)[0m [1mSELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 1 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 1 AND ((start_hour < 7) OR (start_hour = 7 AND start_min <= 15)) AND ((end_hour > 7) OR (end_hour = 7 AND end_min <= 15)))) AS subquery[0m
|
133
|
-
[1m[35mSQL (1.1ms)[0m DELETE FROM "companies" WHERE 1=1
|
134
|
-
[1m[36mWorkingDay Load (0.2ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1[0m
|
135
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "companies" ("name") VALUES ('Moes Tavern')
|
136
|
-
[1m[36mWorkingDay Load (0.1ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 2) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1[0m
|
137
|
-
[1m[35mSQL (0.1ms)[0m INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:39.268266', 18, 45, 8, 30, '2010-11-19 20:17:39.268266', 0, 2, 'ActsAsWorkingDaysTest::Company')
|
138
|
-
[1m[36mWorkingDay Load (0.2ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 2) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 2) LIMIT 1[0m
|
139
|
-
[1m[35mSQL (0.3ms)[0m UPDATE "working_days" SET "end_hour" = 19, "end_min" = 23, "start_hour" = 10, "start_min" = 13, "updated_at" = '2010-11-19 20:17:39.273344' WHERE ("working_days"."id" = 2)
|
140
|
-
[1m[36mSQL (1.1ms)[0m [1mDELETE FROM "companies" WHERE 1=1[0m
|
141
|
-
[1m[35mWorkingDay Load (0.2ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
|
142
|
-
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "companies" ("name") VALUES ('The Leftorium')[0m
|
143
|
-
[1m[35mWorkingDay Load (0.1ms)[0m SELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 3) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1
|
144
|
-
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:39.283311', 18, 45, 8, 30, '2010-11-19 20:17:39.283311', 0, 3, 'ActsAsWorkingDaysTest::Company')[0m
|
145
|
-
[1m[35mSQL (1.1ms)[0m DELETE FROM "companies" WHERE 1=1
|
146
|
-
[1m[36mActsAsWorkingDaysTest::Company Load (0.1ms)[0m [1mSELECT "companies".* FROM "companies"[0m
|
147
|
-
[1m[35mSQL (0.1ms)[0m DELETE FROM "companies" WHERE 1=1
|
148
|
-
[1m[36mWorkingDay Load (0.2ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1[0m
|
149
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "companies" ("name") VALUES ('Moes Tavern')
|
150
|
-
[1m[36mWorkingDay Load (0.1ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 4) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1[0m
|
151
|
-
[1m[35mSQL (0.1ms)[0m INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:39.294696', 18, 45, 8, 30, '2010-11-19 20:17:39.294696', 0, 4, 'ActsAsWorkingDaysTest::Company')
|
152
|
-
[1m[36mSQL (0.3ms)[0m [1mSELECT COUNT(*) AS count_id FROM (SELECT 1 FROM "working_days" WHERE ("working_days".workable_id = 4 AND "working_days".workable_type = 'ActsAsWorkingDaysTest::Company') AND (week_day = 0 AND ((start_hour < 12) OR (start_hour = 12 AND start_min <= NULL)) AND ((end_hour > 12) OR (end_hour = 12 AND end_min <= NULL)))) AS subquery[0m
|
153
|
-
[1m[35mSQL (1.1ms)[0m DELETE FROM "companies" WHERE 1=1
|
154
|
-
[1m[36mWorkingDay Load (0.2ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') LIMIT 1[0m
|
155
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "working_days" ("created_at", "end_hour", "end_min", "start_hour", "start_min", "updated_at", "week_day", "workable_id", "workable_type") VALUES ('2010-11-19 20:17:39.304368', 19, 30, 9, 15, '2010-11-19 20:17:39.304368', 0, NULL, 'ActsAsWorkingDaysTest::Company')
|
156
|
-
[1m[36mWorkingDay Load (0.2ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" IS NULL) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1[0m
|
157
|
-
[1m[35mSQL (0.3ms)[0m INSERT INTO "companies" ("name") VALUES ('Springfield Nuclear Power Plant')
|
158
|
-
[1m[36mWorkingDay Load (0.1ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 5) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1[0m
|
159
|
-
[1m[35mSQL (0.1ms)[0m UPDATE "working_days" SET "updated_at" = '2010-11-19 20:17:39.312441', "workable_id" = 5 WHERE ("working_days"."id" = 5)
|
160
|
-
[1m[36mWorkingDay Load (0.2ms)[0m [1mSELECT "working_days"."id" FROM "working_days" WHERE ("working_days"."week_day" = 0) AND ("working_days"."workable_id" = 5) AND ("working_days"."workable_type" = 'ActsAsWorkingDaysTest::Company') AND ("working_days".id <> 5) LIMIT 1[0m
|
161
|
-
[1m[35mSQL (0.3ms)[0m UPDATE "working_days" SET "end_hour" = 16, "end_min" = 15, "start_hour" = 6, "start_min" = 0, "updated_at" = '2010-11-19 20:17:39.317952' WHERE ("working_days"."id" = 5)
|