Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix bug that kills the MUSIC NOOOOOOOOO

  • Loading branch information...
commit b840062fa8bfbcf1fbea6d2ad518fe67732a239d 1 parent c2ff1f0
@holman holman authored
Showing with 30 additions and 17 deletions.
  1. +24 −14 Gemfile.lock
  2. +6 −3 lib/play/song.rb
View
38 Gemfile.lock
@@ -1,3 +1,18 @@
+PATH
+ remote: .
+ specs:
+ play (0.0.1)
+ SystemTimer
+ activerecord
+ mustache
+ mysql2
+ oa-oauth
+ rack (~> 1.2.2)
+ ruby-audioinfo
+ sinatra
+ sqlite3
+ yajl-ruby
+
GEM
remote: http://rubygems.org/
specs:
@@ -24,8 +39,9 @@ GEM
rack (< 2, >= 1.1.0)
flacinfo-rb (0.4)
i18n (0.5.0)
+ mocha (0.9.12)
mp4info (1.7.3)
- multi_json (0.0.5)
+ multi_json (1.0.1)
multipart-post (1.1.0)
mustache (0.99.3)
mysql2 (0.2.7)
@@ -52,12 +68,13 @@ GEM
wmainfo-rb (>= 0.5)
ruby-mp3info (0.6.13)
ruby-ogginfo (0.6.5)
- sinatra (1.2.3)
+ running_man (0.2.1)
+ sinatra (1.2.6)
rack (~> 1.1)
tilt (< 2.0, >= 1.2.2)
sqlite3 (1.3.3)
- tilt (1.2.2)
- tzinfo (0.3.26)
+ tilt (1.3)
+ tzinfo (0.3.27)
wmainfo-rb (0.6)
yajl-ruby (0.8.2)
@@ -65,13 +82,6 @@ PLATFORMS
ruby
DEPENDENCIES
- SystemTimer
- activerecord
- mustache
- mysql2
- oa-oauth
- rack (~> 1.2.2)
- ruby-audioinfo
- sinatra
- sqlite3
- yajl-ruby
+ mocha
+ play!
+ running_man
View
9 lib/play/song.rb
@@ -72,9 +72,12 @@ def self.office_song
if !users.empty?
artist = users.collect(&:favorite_artists).flatten.shuffle.first
end
- song = artist.songs.shuffle.first
- song ||= Play::Song.order("rand()").first
- song
+
+ if artist
+ artist.songs.shuffle.first
+ else
+ Play::Song.order("rand()").first
+ end
end
# Plays the next song in the queue. Updates the appropriate metainformation
Please sign in to comment.
Something went wrong with that request. Please try again.