-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete statistics displayed in mail
- Loading branch information
Marc Altmann
committed
Aug 3, 2015
1 parent
c92f39d
commit 097e54b
Showing
3 changed files
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
class StatisticsMailer < ActionMailer::Base | ||
default from: EMAIL_ADDRESSES['StatisticsMailer']['mailer_sender'] | ||
|
||
def last_months_numbers_email(revenue_hash) | ||
@revenue_hash = revenue_hash | ||
@month = I18n.l(1.month.ago, format: '%B') | ||
def last_months_numbers_email(statistics) | ||
@revenue_hash = statistics.revenue_last_month | ||
@new_users = statistics.new_users_last_month | ||
@legal_entities_count = statistics.legal_entities_count | ||
@private_users_count = statistics.private_users_count | ||
@legal_entity_articles_count = statistics.legal_entity_articles_count | ||
@private_user_articles_count = statistics.private_user_articles_count | ||
@sum_article_prices = statistics.sum_article_prices | ||
@sum_article_prices_with_quantity = statistics.sum_article_prices_with_quantity | ||
|
||
@month = 1.month.ago | ||
@date = Date.today | ||
|
||
mail(to: EMAIL_ADDRESSES['StatisticsMailer']['mailer_recipient'], | ||
subject: "Statistiken für den Fairmondo-Marktplatz vom #{@month}") | ||
subject: "Statistiken für den Fairmondo-Marktplatz vom #{I18n.l @month, format: '%B'}") | ||
end | ||
|
||
end |
17 changes: 16 additions & 1 deletion
17
app/views/statistics_mailer/last_months_numbers_email.text.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,23 @@ | ||
Dies sind die Statistiken für den Fairmondo-Marktplatz für den <%= @month %>. | ||
Hallo, | ||
|
||
hier die aktuellen Zahlen für den Fairmondo-Marktplatz im Monat <%= I18n.l @month, format: '%B' %>: | ||
|
||
Umsatz: <%= @revenue_hash[:revenue] / 100.0 %> | ||
Gebühr: <%= @revenue_hash[:fee] / 100.0 %> | ||
Faires Prozent: <%= @revenue_hash[:fair] / 100.0 %> | ||
|
||
Neue Nutzer: <%= @new_users %> | ||
|
||
|
||
Insgesamt haben wir heute, am <%= I18n.l @date %>, auf dem Marktplatz: | ||
|
||
Geschäftskunden: <%= @legal_entities_count %> | ||
Privatkunden: <%= @private_users_count %> | ||
Artikel von Geschäftskunden: <%= @legal_entity_articles_count %> | ||
Artikel von Privatkunden: <%= @private_user_articles_count %> | ||
Eingestellter Warenwert (ohne Artikelstückzahlen): <%= @sum_article_prices %> Euro | ||
Eingestellter Warenwert (mit Artikelstückzahlen): <%= @sum_article_prices_with_quantity %> Euro | ||
|
||
|
||
Viele Grüße | ||
Dein Fairmondo-Technik-Team |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters