Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: boblail/changelog
base: ccec7d5fc5
...
head fork: boblail/changelog
compare: 1da121e285
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 24 additions and 5 deletions.
  1. +0 −1  TODO.mdown
  2. +13 −4 app/models/project.rb
  3. +11 −0 test/unit/ticket_test.rb
View
1  TODO.mdown
@@ -1,7 +1,6 @@
# To Do
- **Kanban**:
- - When getting tickets from Unfuddle, synchronize them with a project's saved tickets
- Implement the ability to add/remove tickets to "Staged for Development" (for a project) (Stakeholders only)
- Test variety of colors
- Implement a way of visualizing _age_
View
17 app/models/project.rb
@@ -56,7 +56,13 @@ def find_or_create_tickets_by_number(*numbers)
def find_tickets(*query)
unfuddle_tickets = ticket_system.find_tickets(*query)
unfuddle_tickets.map do |unfuddle_ticket|
- self.tickets.find_by_number(unfuddle_ticket["number"]) || self.tickets.create(Ticket.attributes_from_unfuddle_ticket(unfuddle_ticket))
+ ticket = self.tickets.find_by_number(unfuddle_ticket["number"])
+ if ticket
+ ticket.update_attributes(Ticket.attributes_from_unfuddle_ticket(unfuddle_ticket))
+ else
+ ticket = self.tickets.create(Ticket.attributes_from_unfuddle_ticket(unfuddle_ticket))
+ end
+ ticket
end
end
@@ -64,9 +70,9 @@ def find_tickets(*query)
def tickets_in_queue(queue)
queue = queue.slug if queue.is_a?(KanbanQueue)
- case queue.to_sym
+ tickets = case queue.to_sym
when :staged_for_development
- tickets.in_queue("staged_for_development")
+ self.tickets.in_queue("staged_for_development")
when :in_development
find_tickets(in_development_query, :status => :accepted)
@@ -83,8 +89,11 @@ def tickets_in_queue(queue)
when :last_release
production = environments.find_by_slug("master") # <-- !todo: encode this special knowledge about 'master'
last_release = production && production.releases.first
- last_release ? last_release.tickets : []
+ last_release ? last_release.tickets : []
end
+
+ tickets.each { |ticket| ticket.queue = queue }
+ tickets
end
View
11 test/unit/ticket_test.rb
@@ -34,6 +34,17 @@ class TicketTest < ActiveSupport::TestCase
end
+ test "TicketQueues aren't destroyed or created when you set a ticket's queue to the same value" do
+ ticket = Ticket.create(project_id: 1, number: 1, summary: "Test summary")
+ ticket.set_queue! "in_development"
+ queue = ticket.ticket_queue
+
+ assert_no_difference "TicketQueue.count" do
+ ticket.set_queue! "in_development"
+ end
+ end
+
+
test "a ticket's queue can be mass-assigned on creation" do

No commit comments for this range

Something went wrong with that request. Please try again.