Last active
August 29, 2015 14:11
-
-
Save dancsiqueira/6936e914f2f2a6e87ceb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #Create a directory | |
| dirname = 'public/scripts/' | |
| Dir.mkdir(dirname) unless File.directory?(dirname) | |
| #1 - Mobile Games de 2014 e com mais de 15k views | |
| #2 - Mobile Apps de 2014 e com mais de 8k de views | |
| mobile_games = Mobile::Game.where('created_at > ? AND views > 15000', Time.now.beginning_of_year).order('name ASC') | |
| mobile_apps = Mobile::App.where('created_at > ? AND views > 8000', Time.now.beginning_of_year).order('name ASC') | |
| File.open('public/scripts/mobile_status.txt', 'w') do |file| | |
| file.write("Todos os jogos HTML5 do site mobile lançados neste ano com mais de 15k views \n\n") | |
| mobile_games.each_with_index{ |game, i| file.write("#{ i + 1 }. #{ game.name }\n") } | |
| file.write("\n\nTodos os APPs do site mobile lançados neste ano com mais de 8k views \n\n") | |
| mobile_apps.each_with_index{ |game, i| file.write("#{ i + 1 }. #{ game.name }\n") } | |
| end | |
| #3 - Jogos publicados no CJ e JGO em 2014 | |
| games = ClickJogos::Game.from_date(Time.now.beginning_of_year).order('name ASC') | |
| cj_and_jgo_games = games.map{ |game| game.name if game.has_jgo_namespace && game.has_cj_namespace }.compact | |
| File.open('public/scripts/cj_and_jgo_games.txt', 'w') do |file| | |
| file.write("Todos os jogos que foram publicados em Click Jogos e Joguinhos neste ano \n\n") | |
| cj_and_jgo_games.each_with_index{ |game, i| file.write("#{ i + 1 }. #{ game }\n") } | |
| end | |
| #4 - Jogos publicados em CJ e JDM mas que não tenham a categoria de meninas | |
| non_girls_games = ClickJogos::Game.non_girls.order('name ASC') | |
| cj_and_jdm_non_girls_games = non_girls_games.map{ |game| game.name if game.has_cj_namespace && game.has_jdm_namespace }.compact | |
| File.open('public/scripts/cj_and_jdm_non_girls_games.txt', 'w') do |file| | |
| file.write("Todos os jogos que foram publicados em Click Jogos e Jogos de Meninas mas que NÃO TENHAM a categoria Meninas \n\n") | |
| cj_and_jdm_non_girls_games.each_with_index{ |game, i| file.write("#{ i + 1 }. #{ game }\n") } | |
| end | |
| #5 - Jogos publicados com categoria de meninas e com nota >= 80 | |
| girls_games = ClickJogos::Game.girls.where('created_at > ?', Time.now.beginning_of_year).order('name ASC') | |
| rated_girls_games = girls_games.map{ |game| game.name if game.score >= 80 }.compact | |
| File.open('public/scripts/rated_girls_games.txt', 'w') do |file| | |
| file.write("Todos os jogos que foram lançados neste ano, que tenham a categoria Meninas, com nota igual ou superior a 80 \n\n") | |
| rated_girls_games.each_with_index{ |game, i| file.write("#{ i + 1 }. #{ game }\n") } | |
| end | |
| #6 - Jogos de 2014 com 500k de views e que não estejam na categoria de meninas | |
| games = ClickJogos::Game.from_date(Time.now.beginning_of_year).non_girls.by_min_views(500_000).order('name ASC') | |
| File.open('public/scripts/non_girls_most_viewed_games.txt', 'w') do |file| | |
| file.write("Todos os jogos que foram lançados neste ano que atingiram 500k views (all-time) e que NÃO TENHAM a categoria Meninas \n\n") | |
| games.each_with_index{ |game, i| file.write("#{ i + 1 }. #{ game.name }\n") } | |
| end | |
| #7 - Jogos lançados a partir de Agosto com nota maior >= 80 e que não estejam em categorias de meninas. | |
| since_august_non_girls_games = ClickJogos::Game.non_girls.from_date(Time.new(2014, 8)).order('name ASC') | |
| most_rated_games = since_august_non_girls_games.map{ |game| game.name if game.score >= 80 }.compact | |
| File.open('public/scripts/since_august_non_girls_most_viewed_games.txt', 'w') do |file| | |
| file.write("Todos os jogos que foram lançados de Agosto até agora, que NÃO TENHAM a categoria Meninas, com nota igual ou superior a 80 \n\n") | |
| most_rated_games.each_with_index{ |game, i| file.write("#{ i + 1 }. #{ game }\n") } | |
| end | |
| #Fim |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment