diff --git a/app/components/footer/copyright_component.html.erb b/app/components/footer/copyright_component.html.erb index acde5a71..5364acb4 100644 --- a/app/components/footer/copyright_component.html.erb +++ b/app/components/footer/copyright_component.html.erb @@ -1,10 +1,10 @@
Made with ♥️ by - <%= link_to "pil0u", "slack://user?team=T02NE0241&id=URZ0F4TEF", class: "text-white font-semibold hover:text-aoc-atmospheric" %>, - <%= link_to "Aquaj", "slack://user?team=T02NE0241&id=U0J5GUEAW", class: "text-white font-semibold hover:text-aoc-atmospheric" %> & - <%= link_to "Joenn", "slack://user?team=T02NE0241&id=U045Z0313UP", class: "text-white font-semibold hover:text-aoc-atmospheric" %> + <%= link_to "pil0u", "slack://user?team=T02NE0241&id=URZ0F4TEF", target: :_blank, rel: :noopener, class: "text-white font-semibold hover:text-aoc-atmospheric" %>, + <%= link_to "Aquaj", "slack://user?team=T02NE0241&id=U0J5GUEAW", target: :_blank, rel: :noopener, class: "text-white font-semibold hover:text-aoc-atmospheric" %> & + <%= link_to "Joenn", "slack://user?team=T02NE0241&id=U045Z0313UP", target: :_blank, rel: :noopener, class: "text-white font-semibold hover:text-aoc-atmospheric" %> → - <%= link_to "https://github.com/pil0u/lewagon-aoc", target: :_blank, rel: "noopener", class: "text-other-green hover:link-external" do %> + <%= link_to "https://github.com/pil0u/lewagon-aoc", target: :_blank, rel: :noopener, class: "text-other-green hover:link-external" do %> <% end %>
diff --git a/app/components/footer/nav_component.html.erb b/app/components/footer/nav_component.html.erb index f0447721..a9d47c00 100644 --- a/app/components/footer/nav_component.html.erb +++ b/app/components/footer/nav_component.html.erb @@ -1,6 +1,7 @@ diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index db0a76e6..8bac637d 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -2,7 +2,7 @@ class PagesController < ApplicationController skip_before_action :authenticate_user!, only: %i[admin code_of_conduct faq participation stats welcome] - before_action :render_countdown, only: %i[code_of_conduct faq participation setup stats welcome], if: :render_countdown? + before_action :render_countdown, only: %i[code_of_conduct faq participation patrons setup stats welcome], if: :render_countdown? def admin; end @@ -52,6 +52,15 @@ def participation @cities.sort_by! { |city| [city[:participation_ratio] * -1, city[:vanity_name]] } end + def patrons + @users = User + .select("users.uid, users.username, COUNT(referees.id) AS referrals") + .select("CEIL(100 * LN(COUNT(referees.id) + 1)) AS aura") + .joins("LEFT JOIN users referees ON users.id = referees.referrer_id") + .group("users.id") + .order(aura: :desc) + end + def setup @private_leaderboard = ENV.fetch("AOC_ROOMS").split(",").last diff --git a/app/models/user.rb b/app/models/user.rb index 7df970fd..fea54f11 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -120,6 +120,10 @@ def referral_code "R#{uid.to_s.rjust(5, '0')}" end + def referral_link(request) + "#{request.base_url}/?referral_code=#{referral_code}" + end + def referrer_code referrer&.referral_code end diff --git a/app/views/days/show.html.erb b/app/views/days/show.html.erb index a17a39f7..b5b1d58b 100644 --- a/app/views/days/show.html.erb +++ b/app/views/days/show.html.erb @@ -4,7 +4,7 @@ <% if @day <= Aoc.latest_day %> · - <%= link_to "link to puzzle", Aoc.url(@day), target: :_blank, rel: "noopener", class: "link-explicit link-external" %> + <%= link_to "link to puzzle", Aoc.url(@day), target: :_blank, rel: :noopener, class: "link-explicit link-external" %> <% end %> diff --git a/app/views/pages/admin.html.erb b/app/views/pages/admin.html.erb index 193b6e6e..3f4aaada 100644 --- a/app/views/pages/admin.html.erb +++ b/app/views/pages/admin.html.erb @@ -1,8 +1,8 @@ <% if user_signed_in? %>- This event and the <%= link_to "#aoc Slack channel", Aoc.slack_channel, class: "link-explicit link-slack" %> + This event and the + <%= link_to "#aoc Slack channel", Aoc.slack_channel, target: :_blank, rel: :noopener, class: "link-explicit link-slack" %> should be a safe place for everyone. Always assume positive intent, be positive, friendly and helpful to others. Focus on good vibes; we do not tolerate any form of derogatory comments or personal attacks.
@@ -46,7 +47,8 @@Attempting to access the platform in unauthorized ways is not permitted and is not fun for the community or the - Admins. The platform's code is <%= link_to "open", "https://github.com/pil0u/lewagon-aoc/", target: :_blank, rel: "noopener", class: "link-explicit link-external" %> + Admins. The platform's code is + <%= link_to "open", "https://github.com/pil0u/lewagon-aoc/", target: :_blank, rel: :noopener, class: "link-explicit link-external" %> and all the data you can find here is available upon request. Also, scores are computed from AoC's data, so they cannot be changed by breaking in here anyway.
diff --git a/app/views/pages/faq.html.erb b/app/views/pages/faq.html.erb index 9f57d330..e6c7a100 100644 --- a/app/views/pages/faq.html.erb +++ b/app/views/pages/faq.html.erb @@ -42,7 +42,7 @@- <%= link_to "Advent of Code", "https://adventofcode.com/", target: :_blank, rel: "noopener", class: "link-explicit link-external" %> + <%= link_to "Advent of Code", "https://adventofcode.com/", target: :_blank, rel: :noopener, class: "link-explicit link-external" %> is an Advent calendar of small programming puzzles that you can solve in any programming language.
@@ -72,7 +72,7 @@
Puzzles from past editions are available - <%= link_to "here", "https://adventofcode.com/events", target: :ext, class: "link-explicit link-external" %>. + <%= link_to "here", "https://adventofcode.com/events", target: :_blank, rel: :noopener, class: "link-explicit link-external" %>.
If you get stuck on a puzzle, you can always - <%= link_to "discuss with other Wagoners", Aoc.slack_channel, class: "link-explicit link-slack" %>! This event - is about sharing, learning, and mutual help, irrespective of your skill level. + <%= link_to "discuss with other Wagoners", Aoc.slack_channel, target: :_blank, rel: :noopener, class: "link-explicit link-slack" %>! + This event is about sharing, learning, and mutual help, irrespective of your skill level. It's also a perfect time to reconnect with your campus/batch 🤙
@@ -109,7 +109,7 @@You build your squad by assembling your dream team (find people - <%= link_to "on Slack", Aoc.slack_channel, class: "link-explicit link-slack" %>) and create a squad in your + <%= link_to "on Slack", Aoc.slack_channel, target: :_blank, rel: :noopener, class: "link-explicit link-slack" %>) and create a squad in your <%= link_to "settings", settings_path, class: "link-explicit link-internal" %>(*) in 1 click.
diff --git a/app/views/pages/patrons.html.erb b/app/views/pages/patrons.html.erb new file mode 100644 index 00000000..60574965 --- /dev/null +++ b/app/views/pages/patrons.html.erb @@ -0,0 +1,68 @@ +<%= render PageTitleComponent.new(title: "Patrons") %> + +
+ Influencers of Le Wagon, this is your moment. +
+ +
+ Your referral code
+ <%= current_user.referral_code %>
+ is your fame booster. Share it everywhere to your fellow Wagoners: your batch channel
+ <%= link_to "on Slack", Aoc.slack_channel, target: :_blank, rel: :noopener, class: "link-explicit link-slack" %>,
+ your WhatsApp groups, by mail or pigeon, whatever feels right. You even have a personal link you can share:
+
+ <%= current_user.referral_link(request) %>
+
+
+ + Every time someone signs up using your code, you will increase your aura. Finding people + who solve a few puzzles can only help your aura as well. +
+ +
+ One more thing. The top referrer by December 8th wins a 100€
Amazon voucher 💸
+
+ Good luck! +
++ | Referrals | +Aura | +
---|---|---|
+ <%= link_to user[:username], profile_path(user[:uid]), class: "hover:text-gold" %> + | + ++ <%= user[:referrals] %> + | + ++ <%= user[:aura].to_i %> + | +
<%= current_user.private_leaderboard %>
and click [Join].
@@ -57,7 +57,7 @@
"your settings",
"https://adventofcode.com/settings",
target: :_blank,
- rel: "noopener",
+ rel: :noopener,
class: "link-explicit link-external"
) %>. It's the number next to anonymous user #XXXXXXX
.
@@ -124,7 +124,7 @@
If you have completed all these steps, waited 10 minutes, and your status remains
Pending, please send a message in this
- <%= link_to "Slack thread", "https://lewagon-alumni.slack.com/archives/C02PN711H09/p1700598449505399", class: "link-explicit link-slack" %>
+ <%= link_to "Slack thread", "https://lewagon-alumni.slack.com/archives/C02PN711H09/p1700598449505399", target: :_blank, rel: :noopener, class: "link-explicit link-slack" %>
with the following details:
id:<%= current_user.id %>;aoc_id:<%= current_user.aoc_id %>
- <%= link_to "Advent of Code", "https://adventofcode.com/", target: :_blank, rel: "noopener", class: "link-explicit link-external" %> + <%= link_to "Advent of Code", "https://adventofcode.com/", target: :_blank, rel: :noopener, class: "link-explicit link-external" %> is an Advent calendar of small programming puzzles that can be solved in any programming language you like.
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 39fdc87a..b56b5c85 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -77,14 +77,15 @@ <%= render PageTitleComponent.new(title: "Referral") %>- When you share the event to your friends, ask them to add this referral code during the setup. This will boost your aura. + When you share the event to your friends, ask them to add this referral code during the setup. This will boost your + <%= link_to "aura", patrons_path, class: "strong hover:text-gold" %>.