Last active
September 18, 2017 03:30
-
-
Save sunchen115/894e96953b44d8f594a6e174643f8ece to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'date' | |
def days_between(date1, date2) | |
d1 = Date.parse(date1) | |
d2 = Date.parse(date2) | |
(d2 - d1).to_i | |
end | |
def choose_users(day_offset) | |
(day_offset/7)%2 | |
end | |
def offset(day_offset) | |
day_offset % 7 | |
end | |
def choose_user(now) | |
users1 = %w(文婷 雨辰 陈雨 孙晨 卉卉) | |
users = [users1] | |
day_offset = days_between("2017-05-08", now) | |
users1[offset(day_offset)] | |
end | |
choose_user(Time.now.to_s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment