1
0
Fork 0

Album status

This commit is contained in:
Gregory Eremin 2011-09-14 20:54:39 +04:00
parent 67b6899f9f
commit da97b4d4fc
4 changed files with 11 additions and 2 deletions

View File

@ -81,7 +81,7 @@ class ArtistController < ApplicationController
@artist[:albums] = []
artist.albums.each do |album|
if @@default_album_types.include? album.album_type
if @@default_album_types.include? album.album_type and album.status == 1
tmp_album = {id: album.id, name: album.name, year: album.year, pic: album.pic_url}
album_tracks = []
bonus_tracks = []

View File

@ -48,6 +48,7 @@ class ImportController < ApplicationController
album.album_type = brainz_release_group.type
album.pic_url = album_image
album.has_pic = (album_image != '' and not album_image.nil?)
album.status = 0
dry_run ? ap(album) : album.save
# Tracks from the first release
tracks_hashed = []
@ -72,6 +73,8 @@ class ImportController < ApplicationController
dry_run ? ap(track) : track.save
end
end
album.status = 1
album.save unless dry_run
end
artist.status = 1

View File

@ -0,0 +1,5 @@
class AddStatusToAlbums < ActiveRecord::Migration
def change
add_column :albums, :status, :integer
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20110630052149) do
ActiveRecord::Schema.define(:version => 20110914163231) do
create_table "albums", :force => true do |t|
t.string "name"
@ -23,6 +23,7 @@ ActiveRecord::Schema.define(:version => 20110630052149) do
t.string "album_type"
t.string "mbid"
t.integer "has_pic"
t.integer "status"
end
create_table "artists", :force => true do |t|