Fakultas Ilmu Komputer UI

Commit 3aa57176 authored by Rani Lasma Uli's avatar Rani Lasma Uli
Browse files

add mutant function

parent cbddb048
......@@ -21,3 +21,41 @@ def index(request):
'comment':message,
})
def index_mutant1(request):
if request.method == 'POST' and request.POST['item_text'] != '':
Item.objects.create(text=request.POST['item_text'])
return redirect('/')
items = Item.objects.all()
message = "oh tidak"
# [mutant operation] mutant of items.count() == 0
if items.count() != 0:
message = "yey, waktunya berlibur"
elif items.count() < 5:
message = "sibuk tapi santai"
return render(request, 'to-do-list.html', {
'items': items,
'comment':message,
})
def index_mutant2(request):
if request.method == 'POST' and request.POST['item_text'] != '':
Item.objects.create(text=request.POST['item_text'])
return redirect('/')
items = Item.objects.all()
message = "oh tidak"
if items.count() == 0:
message = "yey, waktunya berlibur"
# [mutant operation] mutant of items.count() < 5
elif items.count() =< 5:
message = "sibuk tapi santai"
return render(request, 'to-do-list.html', {
'items': items,
'comment':message,
})
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment