|
|
@@ -12,7 +12,7 @@ from django.shortcuts import render, get_object_or_404, redirect
|
|
|
|
|
|
from main.forms import StoryForm, EpicForm, RegisterForm, ProfileForm, \
|
|
|
CommentForm, SprintForm
|
|
|
-from main.models import Story, Epic, Sprint, Comment
|
|
|
+from main.models import Story, Epic, Sprint, Comment, Project
|
|
|
|
|
|
|
|
|
@login_required
|
|
|
@@ -73,14 +73,16 @@ def backlog_editor(request):
|
|
|
def sprint_end(request):
|
|
|
|
|
|
current_sprint = Sprint.current()
|
|
|
+ next_sprint = Sprint.next()
|
|
|
|
|
|
if request.method == 'POST':
|
|
|
current_sprint.retro = request.POST["retro"]
|
|
|
+ current_sprint.closed = True
|
|
|
current_sprint.save()
|
|
|
- return HttpResponseRedirect('')
|
|
|
+ return HttpResponseRedirect(request.META['HTTP_REFERER'].split("#")[0] + "#retro-section")
|
|
|
|
|
|
form = SprintForm(instance=current_sprint)
|
|
|
- return render(request, 'sprint_end.html', {'sprint': current_sprint, 'form': form})
|
|
|
+ return render(request, 'sprint_end.html', {'sprint': current_sprint, 'next': next_sprint, 'form': form})
|
|
|
|
|
|
@login_required
|
|
|
def story_index(request):
|
|
|
@@ -177,6 +179,14 @@ def story_close_from_sprintend(_, story_id):
|
|
|
story.save()
|
|
|
return redirect("sprint_end")
|
|
|
|
|
|
+@login_required
|
|
|
+def story_reaffect_ajax(_, story_id):
|
|
|
+ story = get_object_or_404(Story, id=story_id)
|
|
|
+ next_sprint = Sprint.next()
|
|
|
+ story.sprints.add(next_sprint)
|
|
|
+ story.save()
|
|
|
+ return redirect("sprint_end")
|
|
|
+
|
|
|
@login_required
|
|
|
def story_reopen(request, story_id):
|
|
|
story = get_object_or_404(Story, id=story_id)
|
|
|
@@ -266,9 +276,30 @@ def report_sprints(request):
|
|
|
|
|
|
@login_required
|
|
|
def report_projects(request):
|
|
|
- epics = Epic.objects.all()
|
|
|
+ epics = Epic.objects.filter(closed=False)
|
|
|
+
|
|
|
+
|
|
|
return render(request, 'reports/report_projects.html', {'epics': epics})
|
|
|
|
|
|
+def report_activity(request):
|
|
|
+
|
|
|
+ activity = {}
|
|
|
+ for project in Project.objects.all():
|
|
|
+ activity[project] = {}
|
|
|
+ activity[project]["current"] = 0
|
|
|
+ activity[project]["sixmonths"] = 0
|
|
|
+
|
|
|
+ current = True
|
|
|
+ for sprint in Sprint.objects.filter(date_end__lt = datetime.today()).order_by('-date_start')[:12]:
|
|
|
+ for story in sprint.stories.all():
|
|
|
+ if current:
|
|
|
+ activity[story.epic.project]["current"] += story.weight
|
|
|
+ activity[story.epic.project]["sixmonths"] += story.weight
|
|
|
+
|
|
|
+ current = False
|
|
|
+
|
|
|
+ return render(request, 'reports/report_activity.html', {'activity': activity})
|
|
|
+
|
|
|
def com_pack(obj):
|
|
|
pack = {}
|
|
|
pack['obj'] = obj
|