summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/charts.rb6
-rw-r--r--lib/current_settings.rb2
-rw-r--r--lib/model.rb5
3 files changed, 9 insertions, 4 deletions
diff --git a/lib/charts.rb b/lib/charts.rb
index 93e81a5..2472050 100644
--- a/lib/charts.rb
+++ b/lib/charts.rb
@@ -16,10 +16,10 @@ module Charts
def push(from, to, format)
@labels << from.strftime(format)
@total << project.builds.
- where('? > builds.created_at AND builds.created_at > ?', to, from).
+ where('? > ci_builds.created_at AND ci_builds.created_at > ?', to, from).
count(:all)
@success << project.builds.
- where('? > builds.created_at AND builds.created_at > ?', to, from).
+ where('? > ci_builds.created_at AND ci_builds.created_at > ?', to, from).
success.count(:all)
end
end
@@ -59,7 +59,7 @@ module Charts
class BuildTime < Chart
def collect
- commits = project.commits.joins(:builds).where('builds.finished_at is NOT NULL AND builds.started_at is NOT NULL').last(30)
+ commits = project.commits.joins(:builds).where('ci_builds.finished_at is NOT NULL AND ci_builds.started_at is NOT NULL').last(30)
commits.each do |commit|
@labels << commit.short_sha
@build_times << (commit.duration / 60)
diff --git a/lib/current_settings.rb b/lib/current_settings.rb
index 59dedfd..a8c89d4 100644
--- a/lib/current_settings.rb
+++ b/lib/current_settings.rb
@@ -3,7 +3,7 @@ module CurrentSettings
key = :current_application_settings
RequestStore.store[key] ||= begin
- if ActiveRecord::Base.connected? && ActiveRecord::Base.connection.table_exists?('application_settings')
+ if ActiveRecord::Base.connected? && ActiveRecord::Base.connection.table_exists?('ci_application_settings')
ApplicationSetting.current || ApplicationSetting.create_from_defaults
else
fake_application_settings
diff --git a/lib/model.rb b/lib/model.rb
new file mode 100644
index 0000000..dc077c3
--- /dev/null
+++ b/lib/model.rb
@@ -0,0 +1,5 @@
+module Model
+ def table_name_prefix
+ 'ci_'
+ end
+end