Code improvements.
This commit is contained in:
parent
37d787fc42
commit
0acedd39c2
1 changed files with 6 additions and 8 deletions
|
@ -148,7 +148,7 @@ module Import::Zendesk
|
||||||
initialize_client
|
initialize_client
|
||||||
|
|
||||||
# retrive statistic
|
# retrive statistic
|
||||||
statistic = {
|
result = {
|
||||||
'Tickets' => 0,
|
'Tickets' => 0,
|
||||||
'TicketFields' => 0,
|
'TicketFields' => 0,
|
||||||
'UserFields' => 0,
|
'UserFields' => 0,
|
||||||
|
@ -162,20 +162,20 @@ module Import::Zendesk
|
||||||
'Automations' => 0,
|
'Automations' => 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
statistic.each { |object, _score|
|
result.each { |object, _score|
|
||||||
|
|
||||||
counter = 0
|
counter = 0
|
||||||
@client.send( object.underscore.to_sym ).all do |_resource|
|
@client.send( object.underscore.to_sym ).all do |_resource|
|
||||||
counter += 1
|
counter += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
statistic[ object ] = counter
|
result[ object ] = counter
|
||||||
}
|
}
|
||||||
|
|
||||||
if statistic
|
if result
|
||||||
Cache.write('import_zendesk_stats', statistic)
|
Cache.write('import_zendesk_stats', result)
|
||||||
end
|
end
|
||||||
statistic
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
@ -763,7 +763,6 @@ module Import::Zendesk
|
||||||
elsif zendesk_article.via.channel == 'twitter'
|
elsif zendesk_article.via.channel == 'twitter'
|
||||||
local_article_fields[:message_id] = zendesk_article.id
|
local_article_fields[:message_id] = zendesk_article.id
|
||||||
|
|
||||||
# TODO
|
|
||||||
local_article_fields[:type_id] = if zendesk_article.via.source.rel == 'mention'
|
local_article_fields[:type_id] = if zendesk_article.via.source.rel == 'mention'
|
||||||
article_type_twitter_status.id
|
article_type_twitter_status.id
|
||||||
else
|
else
|
||||||
|
@ -776,7 +775,6 @@ module Import::Zendesk
|
||||||
local_article_fields[:to] = zendesk_article.via.source.to.facebook_id
|
local_article_fields[:to] = zendesk_article.via.source.to.facebook_id
|
||||||
local_article_fields[:message_id] = zendesk_article.id
|
local_article_fields[:message_id] = zendesk_article.id
|
||||||
|
|
||||||
# TODO
|
|
||||||
local_article_fields[:type_id] = if zendesk_article.via.source.rel == 'post'
|
local_article_fields[:type_id] = if zendesk_article.via.source.rel == 'post'
|
||||||
article_type_facebook_feed_post.id
|
article_type_facebook_feed_post.id
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue