ft_42 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ft_42.rb +14 -12
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb407904edef47365ea3c1df389a106276d85577
4
- data.tar.gz: 4fa237f7f729a503f00ddc9ada75221c6d49a54e
3
+ metadata.gz: b6f4ab50070c4ba2b18363454eecf5258c41be89
4
+ data.tar.gz: e8bfb2616c082f0f174f7c0da378e299dedb25fb
5
5
  SHA512:
6
- metadata.gz: d93f5d26845a702d38453d9dd64cf26f38df21dd43abb76cebd9ddd494bd9e7a6fcd875488bb8e4ce75ddeafe42a113043a3e1b2aa944fb4a7a0a5c901d82409
7
- data.tar.gz: ced89cffecd449a0fd91783678f08c02a0238963f7694176721bce1775ee5d66788dce640c50cf7290ae6007bc3a3d06a41456ceba8a109b084696d773da54c7
6
+ metadata.gz: f86c868b86015ca547ee6b37b1b69363118f6e57e529cd0e40d9cce3482a47453117f6076f1ae1fe0d54f77495b268356c6e63fe778cb7d20cbb410e9c59bbab
7
+ data.tar.gz: 83cf4ea9b4941e132a896f4a64123a2ad0f06ca1ff6deb59258f3092f3300ad01679a8cc6a16bb68d73d92a6d9d40369b9054474ecc7e2b080448b093eee9c68
data/lib/ft_42.rb CHANGED
@@ -320,7 +320,7 @@ class Session
320
320
  end
321
321
 
322
322
  def end_at
323
- session["end_at"].to_time
323
+ session["end_at"].to_time unless session["end_at"].nil?
324
324
  end
325
325
 
326
326
  def host
@@ -332,7 +332,7 @@ class Session
332
332
  end
333
333
 
334
334
  def duration
335
- end_at - begin_at
335
+ end_at - begin_at unless end_at.nil?
336
336
  end
337
337
  end
338
338
 
@@ -352,7 +352,7 @@ class UserSessions
352
352
  def total_hours_this_week
353
353
  total_duration = 0
354
354
  sessions.each do |session|
355
- total_duration += session.duration
355
+ total_duration += session.duration || 0
356
356
  end
357
357
  (total_duration / 60 / 60).round
358
358
  end
@@ -493,14 +493,16 @@ class UserSessionsPrinter
493
493
  unless user_sessions.sessions.empty?
494
494
  active = false
495
495
  user_sessions.sessions.each do |session|
496
- if session.end_at - session.begin_at == 600.0
497
- unless active
498
- puts "Is #{highlight('active')} at " + highlight("#{cluster(session.host)}") + " computer #{session.host}."
496
+ unless session.end_at.nil?
497
+ if session.end_at - session.begin_at == 600.0
498
+ unless active
499
+ puts "Is #{highlight('active')} at " + highlight("#{cluster(session.host)}") + " computer #{session.host}."
500
+ end
501
+ unless session.primary?
502
+ puts warning("Warning: Logged in on more than one computer. Please logout from #{session.host} ASAP.")
503
+ end
504
+ active = true
499
505
  end
500
- unless session.primary?
501
- puts warning("Warning: Logged in on more than one computer. Please logout from #{session.host} ASAP.")
502
- end
503
- active = true
504
506
  end
505
507
  end
506
508
 
@@ -511,7 +513,7 @@ class UserSessionsPrinter
511
513
  end
512
514
 
513
515
  def last_active
514
- puts "Was last active " + last_active_time_ago + " at #{last_active_computer}."
516
+ puts "Was last active " + (last_active_time_ago || "") + " at #{last_active_computer}."
515
517
  end
516
518
 
517
519
  def hours_this_week
@@ -599,7 +601,7 @@ class UserSessionsPrinter
599
601
  end
600
602
 
601
603
  def last_active_time_ago
602
- highlight("#{ActionView::Base.new.time_ago_in_words(user_sessions.sessions.first.end_at)} ago")
604
+ highlight("#{ActionView::Base.new.time_ago_in_words(user_sessions.sessions.first.end_at)} ago") unless user_sessions.sessions.first.end_at.nil?
603
605
  end
604
606
 
605
607
  def last_active_computer
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ft_42
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Fernandez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-04 00:00:00.000000000 Z
11
+ date: 2017-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack