Fakultas Ilmu Komputer UI

Commit 8c4f705f authored by Rayza Arasj Mahardhika's avatar Rayza Arasj Mahardhika
Browse files

refactor implementation to use constants

parent cdd9652f
Pipeline #21065 failed with stage
in 3 minutes and 7 seconds
...@@ -3,13 +3,17 @@ from django.shortcuts import redirect, render ...@@ -3,13 +3,17 @@ from django.shortcuts import redirect, render
from lists.models import Item from lists.models import Item
COMMENTARY_ZERO = 'yey, waktunya berlibur'
COMMENTARY_LESS_THAN_FIVE = 'sibuk tapi santai'
def get_commentary(item_count): def get_commentary(item_count):
if (item_count == 0): if (item_count == 0):
return 'yey, waktunya berlibur' return COMMENTARY_ZERO
elif (item_count < 5): elif (item_count < 5):
return 'sibuk tapi santai' return COMMENTARY_LESS_THAN_FIVE
elif (item_count >= 5): elif (item_count >= 5):
return 'oh tidak' return COMMENTARY_MORE_THAN_EQUAL_FIVE
def home_page(request): def home_page(request):
if request.method == 'POST': if request.method == 'POST':
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