Merge branch 'develop' of github.com:martini/zammad into develop
This commit is contained in:
commit
6ba881a327
2 changed files with 18 additions and 47 deletions
|
@ -23,9 +23,9 @@ class ReportsController < ApplicationController
|
||||||
created = aggs(start, stop, 'minute', 'created_at')
|
created = aggs(start, stop, 'minute', 'created_at')
|
||||||
closed = aggs(start, stop, 'minute', 'close_time')
|
closed = aggs(start, stop, 'minute', 'close_time')
|
||||||
elsif params[:timeRange] == 'day'
|
elsif params[:timeRange] == 'day'
|
||||||
start = Date.parse("#{params[:year]}-#{params[:month]}-#{params[:day]}").iso8601
|
date = Date.parse("#{params[:year]}-#{params[:month]}-#{params[:day]}").to_s
|
||||||
start = "#{start}T00:00:00Z"
|
start = "#{date}T00:00:00Z"
|
||||||
stop = "#{start}T23:59:59Z"
|
stop = "#{date}T23:59:59Z"
|
||||||
created = aggs(start, stop, 'hour', 'created_at')
|
created = aggs(start, stop, 'hour', 'created_at')
|
||||||
closed = aggs(start, stop, 'hour', 'close_time')
|
closed = aggs(start, stop, 'hour', 'close_time')
|
||||||
elsif params[:timeRange] == 'week'
|
elsif params[:timeRange] == 'week'
|
||||||
|
@ -61,9 +61,9 @@ class ReportsController < ApplicationController
|
||||||
start = (Time.zone.now - 60.minutes).iso8601
|
start = (Time.zone.now - 60.minutes).iso8601
|
||||||
stop = Time.zone.now.iso8601
|
stop = Time.zone.now.iso8601
|
||||||
elsif params[:timeRange] == 'day'
|
elsif params[:timeRange] == 'day'
|
||||||
start = Date.parse("#{params[:year]}-#{params[:month]}-#{params[:day]}").iso8601
|
date = Date.parse("#{params[:year]}-#{params[:month]}-#{params[:day]}").to_s
|
||||||
start = "#{start}T00:00:00Z"
|
start = "#{date}T00:00:00Z"
|
||||||
stop = "#{start}T23:59:59Z"
|
stop = "#{date}T23:59:59Z"
|
||||||
elsif params[:timeRange] == 'week'
|
elsif params[:timeRange] == 'week'
|
||||||
start = Date.commercial(params[:year], params[:week]).iso8601
|
start = Date.commercial(params[:year], params[:week]).iso8601
|
||||||
stop = Date.parse(start).end_of_week
|
stop = Date.parse(start).end_of_week
|
||||||
|
@ -86,10 +86,14 @@ class ReportsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def aggs(range_start, range_end, interval, field)
|
def aggs(range_start, range_end, interval, field)
|
||||||
|
interval_es = interval
|
||||||
|
if interval == 'week'
|
||||||
|
interval_es = 'day'
|
||||||
|
end
|
||||||
result = SearchIndexBackend.aggs(
|
result = SearchIndexBackend.aggs(
|
||||||
{
|
{
|
||||||
},
|
},
|
||||||
[range_start, range_end, field, interval],
|
[range_start, range_end, field, interval_es],
|
||||||
['Ticket'],
|
['Ticket'],
|
||||||
)
|
)
|
||||||
data = []
|
data = []
|
||||||
|
@ -119,12 +123,13 @@ class ReportsController < ApplicationController
|
||||||
end
|
end
|
||||||
next if !item['doc_count']
|
next if !item['doc_count']
|
||||||
next if item['key_as_string'] !~ /#{start_string}/
|
next if item['key_as_string'] !~ /#{start_string}/
|
||||||
|
next if match
|
||||||
match = true
|
match = true
|
||||||
data.push [counter, item['doc_count']]
|
data.push [counter, item['doc_count']]
|
||||||
if interval == 'month'
|
if interval == 'month'
|
||||||
start = start.next_month
|
start = start.next_month
|
||||||
elsif interval == 'week'
|
elsif interval == 'week'
|
||||||
start = start.next_week
|
start = start.next_day
|
||||||
elsif interval == 'day'
|
elsif interval == 'day'
|
||||||
start = start.next_day
|
start = start.next_day
|
||||||
elsif interval == 'hour'
|
elsif interval == 'hour'
|
||||||
|
@ -138,7 +143,7 @@ class ReportsController < ApplicationController
|
||||||
if interval == 'month'
|
if interval == 'month'
|
||||||
start = start.next_month
|
start = start.next_month
|
||||||
elsif interval == 'week'
|
elsif interval == 'week'
|
||||||
start = start.next_week
|
start = start.next_day
|
||||||
elsif interval == 'day'
|
elsif interval == 'day'
|
||||||
start = start + 1.day
|
start = start + 1.day
|
||||||
elsif interval == 'hour'
|
elsif interval == 'hour'
|
||||||
|
|
|
@ -10,6 +10,9 @@ class CreateReport < ActiveRecord::Migration
|
||||||
end
|
end
|
||||||
add_index :report_profiles, [:name], unique: true
|
add_index :report_profiles, [:name], unique: true
|
||||||
|
|
||||||
|
# return if it's a new setup
|
||||||
|
return if !Setting.find_by(name: 'system_init_done')
|
||||||
|
|
||||||
Report::Profile.create_if_not_exists(
|
Report::Profile.create_if_not_exists(
|
||||||
name: '-all-',
|
name: '-all-',
|
||||||
condition: {},
|
condition: {},
|
||||||
|
@ -17,44 +20,7 @@ class CreateReport < ActiveRecord::Migration
|
||||||
updated_by_id: 1,
|
updated_by_id: 1,
|
||||||
created_by_id: 1,
|
created_by_id: 1,
|
||||||
)
|
)
|
||||||
|
Role.create_if_not_exists(name: 'Report', created_by_id: 1, updated_by_id: 1)
|
||||||
Role.create_if_not_exists( name: 'Report', created_by_id: 1, updated_by_id: 1 )
|
|
||||||
Translation.create_if_not_exists(
|
|
||||||
locale: 'de-de',
|
|
||||||
source: 'Ticket Count',
|
|
||||||
target: 'Ticket Anzahl',
|
|
||||||
updated_by_id: 1,
|
|
||||||
created_by_id: 1,
|
|
||||||
)
|
|
||||||
Translation.create_if_not_exists(
|
|
||||||
locale: 'de-de',
|
|
||||||
source: 'Ticket Count',
|
|
||||||
target: 'Ticket Anzahl',
|
|
||||||
updated_by_id: 1,
|
|
||||||
created_by_id: 1,
|
|
||||||
)
|
|
||||||
Translation.create_if_not_exists(
|
|
||||||
locale: 'de-de',
|
|
||||||
source: 'Create Channels',
|
|
||||||
target: 'Erstellkanäle',
|
|
||||||
updated_by_id: 1,
|
|
||||||
created_by_id: 1,
|
|
||||||
)
|
|
||||||
Translation.create_if_not_exists(
|
|
||||||
locale: 'de-de',
|
|
||||||
source: 'Times',
|
|
||||||
target: 'Zeiten',
|
|
||||||
updated_by_id: 1,
|
|
||||||
created_by_id: 1,
|
|
||||||
)
|
|
||||||
Translation.create_if_not_exists(
|
|
||||||
locale: 'de-de',
|
|
||||||
source: 'Communication',
|
|
||||||
target: 'Kommunikation',
|
|
||||||
updated_by_id: 1,
|
|
||||||
created_by_id: 1,
|
|
||||||
)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
|
|
Loading…
Reference in a new issue