air18n 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/air18n/phrase_translation.rb +11 -5
- data/lib/air18n/version.rb +1 -1
- data/make_gem +1 -1
- metadata +2 -2
@@ -172,20 +172,26 @@ module Air18n
|
|
172
172
|
rich_memory.save!
|
173
173
|
end
|
174
174
|
|
175
|
+
def self.fill_in_payment_data(activity_data, compute_payment_method)
|
176
|
+
activity_data.each do |stats|
|
177
|
+
stats[:currency] = 'EUR'
|
178
|
+
stats[:native_amount] = compute_payment_method.call(stats[:activity][:word_count_translations], stats[:activity][:word_count_verifications], stats[:user_id], stats[:locale].to_sym)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
175
182
|
def self.translator_payment_data(compute_payment_method)
|
176
183
|
today_last_month = 1.month.ago
|
177
184
|
ret = []
|
178
|
-
PhraseTranslation.translator_activity_data(0, :since => 2.months.ago)
|
185
|
+
activity_data = PhraseTranslation.translator_activity_data(0, :since => 2.months.ago)
|
186
|
+
fill_in_payment_data(activity_data, compute_payment_method)
|
187
|
+
activity_data.each do |stats|
|
179
188
|
if stats[:year] == today_last_month.year && stats[:month] == today_last_month.month && stats[:user_id] > 0
|
180
189
|
user = User.find_by_id(stats[:user_id])
|
181
190
|
stats[:smart_name] = user.try(:smart_name)
|
182
191
|
|
183
|
-
stats[:currency] = 'EUR'
|
184
192
|
stats[:is_admin] = user.try(:role_admin?)
|
185
193
|
stats[:is_paid] = !stats[:is_admin] && !fetch_unpaid_nonadmin_translator_list.include?(stats[:user_id])
|
186
|
-
|
187
|
-
stats[:native_amount] = payment
|
188
|
-
stats[:usd_amount] = Currency.convert(payment, stats[:currency], "USD").round
|
194
|
+
stats[:usd_amount] = Currency.convert(stats[:native_amount], stats[:currency], "USD").round
|
189
195
|
if stats[:is_paid] && stats[:usd_amount] > 0
|
190
196
|
stats[:description] = "Translator payout "
|
191
197
|
stats[:description] << "for #{Date::MONTHNAMES[today_last_month.month]} #{today_last_month.year}. "
|
data/lib/air18n/version.rb
CHANGED
data/make_gem
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: air18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2012-07-
|
16
|
+
date: 2012-07-20 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: i18n
|