Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Prevent double-submit of status change on scrum board

  • Loading branch information...
commit 4fe5e2bffd3b6ccedb6e285d4cff9b17a7a5ecac 1 parent 7804ea2
Marc Hughes authored
View
2  scrumdo-web/apps/projects/story_views.py
@@ -134,6 +134,8 @@ def scrum_board( request, group_slug, story_id):
story = get_object_or_404( Story, id=story_id )
project = get_object_or_404( Project, slug=group_slug )
if request.method == 'POST':
+ if request.POST.get("status",None) == None:
+ return HttpResponse("FAILED")
target_status = status_map[request.POST.get("status")]
reorderStory( story, request.POST.get("before"), request.POST.get("after"), story.iteration, field_name="board_rank")
if story.status != target_status:
View
14 scrumdo-web/media/js/scrum-board.js
@@ -68,6 +68,8 @@ function setBigStories()
story_size = 3;
}
+var last_story_sort = null;
+
function onSortStory(event, ui)
{
var ind = ui.item.index();
@@ -83,11 +85,17 @@ function onSortStory(event, ui)
{
after = $(children[ind+1]).attr("story_id");
}
-
+ var story_id = $(ui.item).attr("story_id");
var target_status = $(ui.item).parent().attr("id");
-
+ var unique_key = story_id + target_status + before + after;
+ if( last_story_sort == unique_key )
+ {
+ // Hack... we're getting double entries here on some browsers. Here's a quick check to avoid that.
+ return;
+ }
+ last_story_sort = unique_key;
$.ajax({
- url: "/projects/project/" + project_slug + "/story/" + $(ui.item).attr("story_id") + "/scrum_board",
+ url: "/projects/project/" + project_slug + "/story/" + story_id + "/scrum_board",
data:({ action:"reorder", before:before, after:after, iteration:iteration_id, status:target_status, rank_type:"board_rank" }),
type: "POST",
success: function() {
Please sign in to comment.
Something went wrong with that request. Please try again.