ft_42 0.1.4 → 0.1.5

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ft_42.rb +36 -8
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f077daff0ef965b8b587758f4796a6887ad88573
4
- data.tar.gz: c3dbbffa772ffa5db211568482f8ef2c5133979c
3
+ metadata.gz: 3f45981764a39ac7972d04326bb0ddeb984ad3f4
4
+ data.tar.gz: f1b7cc5c42dc1842a889e6ae3469af9e1d10c399
5
5
  SHA512:
6
- metadata.gz: '09a73fb46d61fe4fd4e11764418f6ab7567f29d2dc518c14c2db664e509033683cde9b3e0c0f2ab725332da5687f200b21f7d12f231184ae425365a785eebe24'
7
- data.tar.gz: e03b9b90d61a4e25999322663d64d6ee7562a547065131131389498893c0ec5518e6e28657ab71410b3646fc97bac67fa7474987f9bc08c9399776850e83c845
6
+ metadata.gz: 6927c032aa1232969c9423b0a578000cfa6a3837a8841124eed00550cd3ab31cfba5a08fea2fcded62f3abaea6789f93d3ba104abaec25c8248375b381fc7a6b
7
+ data.tar.gz: 12dca87a67aa6509e4aa36bdd24afb8de7c860e3ebf169e45c2ccdfaef4ee5d4b7e1ea584f0fe06af07ae6fa634d912c51d793b1a869cb1134b956414cb75864
data/lib/ft_42.rb CHANGED
@@ -5,10 +5,12 @@ require "oauth2"
5
5
  require "ruby-progressbar"
6
6
 
7
7
  module Constants
8
- URL_42 = "https://api.intra.42.fr"
9
- UID_42 = ENV.fetch("FT42_UID")
10
- SECRET_42 = ENV.fetch("FT42_SECRET")
11
- HOURS_NEEDED = 38
8
+ URL_42 = "https://api.intra.42.fr"
9
+ UID_42 = ENV.fetch("FT42_UID")
10
+ SECRET_42 = ENV.fetch("FT42_SECRET")
11
+ HOURS_NEEDED = 38
12
+ HOURS_ACHIEVEMENT = 90
13
+ HOURS_CHALLENGE = 100
12
14
  end
13
15
 
14
16
 
@@ -217,7 +219,7 @@ class UserPrinter
217
219
 
218
220
  def correction_points
219
221
  print "Has #{highlight(ActionView::Base.new.pluralize(user.correction_points, 'correction point'))}."
220
- grabs_pitchfork if user.correction_points > 6
222
+ grabs_pitchfork if user.correction_points > 8
221
223
  puts
222
224
  end
223
225
 
@@ -279,16 +281,42 @@ class UserSessionsPrinter
279
281
  end
280
282
 
281
283
  def hours_this_week
282
- puts "Has " + highlight("#{hours} #{hours_pluralize}") + " in the clusters this week, starting #{last_monday}. #{'Go to sleep.' if hours > 60}"
284
+ puts "Has " + highlight("#{hours} #{hours_pluralize}") + " in the clusters this week, starting #{last_monday}."
283
285
  hours_progress_bar
286
+ hours_progress_bar_achievement
287
+ hours_progress_bar_challenge
284
288
  end
285
289
 
286
290
  def hours_progress_bar
287
291
  percent_complete = ((hours.to_f / HOURS_NEEDED.to_f) * 100).round
288
292
  if (percent_complete <= 100)
289
- progressbar_needed = ProgressBar.create(progress_mark: "█", length: 60, format: "%t: |" + warning("%B") + "| #{hours}/38 hours")
293
+ progressbar_needed = ProgressBar.create(progress_mark: "█", length: 64, format: "%t: |" + warning("%B") + "| #{hours}/38 hours")
290
294
  percent_complete.times { progressbar_needed.increment }
291
- puts progressbar_needed
295
+ print "Minimum "
296
+ print progressbar_needed
297
+ puts
298
+ end
299
+ end
300
+
301
+ def hours_progress_bar_achievement
302
+ percent_complete = ((hours.to_f / HOURS_ACHIEVEMENT.to_f) * 100).round
303
+ if (percent_complete <= 100)
304
+ progressbar_needed = ProgressBar.create(progress_mark: "█", length: 60, format: "%t: |" + warning("%B") + "| #{hours}/90 hours")
305
+ percent_complete.times { progressbar_needed.increment }
306
+ print "Achievement "
307
+ print progressbar_needed
308
+ puts
309
+ end
310
+ end
311
+
312
+ def hours_progress_bar_challenge
313
+ percent_complete = ((hours.to_f / HOURS_CHALLENGE.to_f) * 100).round
314
+ if (percent_complete <= 100)
315
+ progressbar_needed = ProgressBar.create(progress_mark: "█", length: 63, format: "%t: |" + warning("%B") + "| #{hours}/100 hours")
316
+ percent_complete.times { progressbar_needed.increment }
317
+ print "Challenge "
318
+ print progressbar_needed
319
+ puts
292
320
  end
293
321
  end
294
322
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ft_42
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Fernandez