Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Badges for 48in24 #7207

Merged
merged 12 commits into from
Jan 22, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def status(exercise)
completed_exercises = completions[exercise[:slug]].to_a
return :in_progress if completed_exercises.blank?

num_completions_in_2024 = completed_exercises.count { |(_, year)| year == 2024 }
num_completions_in_2024 = completed_exercises.count { |(_, date)| date >= '2023-12-31' && date <= '2025-01-01' }
return :in_progress if num_completions_in_2024.zero?
return :bronze if num_completions_in_2024 < 3

Expand All @@ -86,11 +86,12 @@ def completions
user.solutions.completed.
joins(exercise: :track).
where(exercise: { slug: EXERCISES.pluck(:slug) }).
pluck('exercise.slug', 'tracks.slug', 'YEAR(completed_at)').
pluck('exercise.slug', 'tracks.slug', Arel.sql("DATE_FORMAT(completed_at, '%Y-%m-%d')")).
group_by(&:first).
transform_values { |entries| entries.map { |entry| entry[1..] } }
end

memoize
def csharp_exercises
Track.find('csharp').practice_exercises.index_by(&:slug)
rescue ActiveRecord::RecordNotFound
Expand Down
4 changes: 2 additions & 2 deletions app/css/components/badge.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion app/css/components/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
& .--close-button {
@apply fixed rounded-circle shadow-smZ1 bg-purpleDarker3;
@apply border-2 border-transparent;
@apply grid place-items-center;
@apply grid place-items-center z-modal;

cursor: pointer;
top: 48px;
right: 48px;
Expand Down
15 changes: 15 additions & 0 deletions app/images/icons/48in24-participant.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions app/images/icons/larisa-latynina.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading