Commit 91f6d6df by Dányi Bence

webui: dont count deleted vms (fixes #68)

parent ab21b946
...@@ -33,11 +33,13 @@ def _list_instances(request): ...@@ -33,11 +33,13 @@ def _list_instances(request):
instances = Instance.objects.exclude(state='DONE').filter(owner=request.user) instances = Instance.objects.exclude(state='DONE').filter(owner=request.user)
for i in instances: for i in instances:
i.update_state() i.update_state()
instances = instances.exclude(state='DONE')
return instances return instances
@require_GET @require_GET
@login_required @login_required
def home(request): def home(request):
instances = _list_instances(request)
shares = [s for s in request.user.person_set.all()[0].get_shares()] shares = [s for s in request.user.person_set.all()[0].get_shares()]
for i, s in enumerate(shares): for i, s in enumerate(shares):
s.running_shared = s.instance_set.all().exclude(state="DONE").filter(owner=request.user).count() s.running_shared = s.instance_set.all().exclude(state="DONE").filter(owner=request.user).count()
...@@ -52,10 +54,10 @@ def home(request): ...@@ -52,10 +54,10 @@ def home(request):
except: except:
generated_public_key = -1 generated_public_key = -1
return render_to_response("home.html", RequestContext(request, { return render_to_response("home.html", RequestContext(request, {
'instances': instances,
'shares': shares, 'shares': shares,
'templates': Template.objects.filter(state='READY'), 'templates': Template.objects.filter(state='READY'),
'mytemplates': Template.objects.filter(owner=request.user), 'mytemplates': Template.objects.filter(owner=request.user),
'instances': _list_instances(request),
'groups': request.user.person_set.all()[0].owned_groups.all(), 'groups': request.user.person_set.all()[0].owned_groups.all(),
'semesters': Semester.objects.all(), 'semesters': Semester.objects.all(),
'userdetails': details, 'userdetails': details,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment