Permalink
Browse files

No need to set the same variable (uid_date) twice

  • Loading branch information...
1 parent f9abe13 commit 460ba9491369aa9bef37235df535ab77860b3ebb @jeroenj committed Nov 13, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 import.rb
View
@@ -15,10 +15,10 @@
to = tr.css('td')[3].content.strip
date_time = Time.parse tr.css('td')[5].content.gsub(/u/, ':')
- if (1..5).include?(date_time.wday)
- uid_date = date_time - ((date_time.wday - 1) * days) # monday of that week
+ uid_date = if (1..5).include?(date_time.wday)
+ date_time - ((date_time.wday - 1) * days) # monday of that week
else # 6 & 0 => weekend
- uid_date = date_time.wday == 0 ? (date_time - (1 * days)) : date_time # saturday of that week
+ date_time.wday == 0 ? (date_time - (1 * days)) : date_time # saturday of that week
end
uid = "#{from[0]}#{to[0]}#{(1..5).include?(date_time.wday) ? 'W' : 'WE'}#{uid_date.strftime('%Y%m%d')}"

0 comments on commit 460ba94

Please sign in to comment.