Skip to content

Commit

Permalink
fixed checklist bug [#18 state:resolved]
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Hoyt authored and Jonathan Hoyt committed Dec 22, 2008
1 parent f661de4 commit b132cbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/controllers/checklists_controller.rb
Expand Up @@ -54,7 +54,8 @@ def create
def remove_from_ticket
@checklist = Checklist.find(params[:id])
TicketEntry.create(:entry_type => "Removed Checklist", :note => "Checklist (#{@checklist.name}) was removed from this ticket.", :billable => false, :private => true, :detail => 6, :ticket => @checklist.ticket, :creator_id => current_user.id)
@checklist.destroy
@checklist.ticket_id = nil
@checklist.save
redirect_to :back
end

Expand Down
5 changes: 3 additions & 2 deletions app/models/ticket.rb
Expand Up @@ -81,8 +81,9 @@ def self.totals(user)
end

def checklists_complete?
checklists = self.checklists
checklists << self.devices.collect{|device| device.checklists}.flatten
checklists = []
checklists.concat(self.checklists)
checklists.concat(self.devices.collect{|device| device.checklists}.flatten)
complete = 0
checklists.each do |checklist|
checklist.complete? ? complete += 0 : complete += 1
Expand Down

0 comments on commit b132cbb

Please sign in to comment.