Skip to content
Browse files

Bug [#44460909] Losing data when paginating

On the date:changed event, the work_weeks view receives a message about
the pagination so that it can change its collection of weeks to show.
This message contains a "begin" attribute that was set to a Moment
object instead of the associated timestamp, which triggered the bug.
  • Loading branch information...
1 parent 44e9905 commit 5652a379aaf0b81f1898df05f7a7f756ffc52569 @Veejay Veejay committed
Showing with 8 additions and 13 deletions.
  1. +1 −1 .ruby-version
  2. +7 −12 app/assets/javascripts/views/projects/work_weeks.js.coffee
View
2 .ruby-version
@@ -1 +1 @@
-1.9.3-p374
+1.9.3-p385
View
19 app/assets/javascripts/views/projects/work_weeks.js.coffee
@@ -5,9 +5,8 @@ class window.StaffPlan.Views.Projects.WorkWeeks extends Support.CompositeView
initialize: ->
@start = @options.start
@count = @options.count
-
@on "date:changed", (message) =>
- @start = message.begin
+ @start = message.begin.valueOf()
@count = message.count
@render()
@@ -28,7 +27,6 @@ class window.StaffPlan.Views.Projects.WorkWeeks extends Support.CompositeView
$currentTarget = $( event.currentTarget )
cid = $currentTarget.data 'cid'
-
@queueUpdateOrCreate event, cid,
estimated_hours: $currentTarget.val()
@@ -50,15 +48,13 @@ class window.StaffPlan.Views.Projects.WorkWeeks extends Support.CompositeView
workWeek = @collection.get cid
if workWeek? and ((parseInt(attributes["estimated_hours"], 10) > 0) or (parseInt(attributes["actual_hours"], 10) > 0))
assignment = workWeek.collection.parent
+ if assignment.get("archived")
+ assignment.save {archived: false},
+ success: (model, response, options) ->
+ console.log response
+ , error: (model, xhr, options) ->
+ alert "Failed to unarchive the assignment. Try again?"
- assignment.save {archived: false},
- success: (model, response, options) ->
- console.log response
- , error: (model, xhr, options) ->
- alert "Failed to unarchive the assignment. Try again?"
-
- element = $(event.currentTarget)
-
workWeek.save attributes,
error: ->
alert('Failed to save that hourly data. Try again?')
@@ -101,7 +97,6 @@ class window.StaffPlan.Views.Projects.WorkWeeks extends Support.CompositeView
render: ->
@$el.empty()
-
range = _.range(@start, @start + @count * 7 * 86400 * 1000, 7 * 86400 * 1000)
_.each range, (timestamp) =>
unless (@collection.detect (week) -> week.get("beginning_of_week") is timestamp)?

0 comments on commit 5652a37

Please sign in to comment.
Something went wrong with that request. Please try again.