Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions neuropy/neuropy/templates/neuropy/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1>About Neuropy</h1>

<p>A personalized priority app to support a Cognitive Behavioral Therapy (CBT) approach to efficiently organize your day according to a struggle/disorder that is effectively treated by CBT. CBT is a goal-oriented pyschotherapy treatment, taking a hands-on approach to problem solving. Goal of CBT is to change the patterns of thinking or behavior that are behind a person's difficulties, modifying their feelings and therefore their thinking and behavior overtime.</p>

<p>Neuropy Considers what the habit/disorder the user wants to treat with CBT, along with medication, it's half-life and peak periods. Also works around black-out periods on user's schedule by syncing with Google Calender, personal preference or most productive period of the day for user, and finally considers time commitments for each activity. Each "TO-DO" will be ranked considering these aspects and will be worked into periods of the day.</p>
<p>Neuropy Considers what the habit/disorder the user wants to treat with CBT, along with medication, its efficacy, and peak periods. Also works around black-out periods on user's schedule by syncing with Google Calender, personal preference or most productive period of the day for user, and finally considers time commitments for each activity. Each "TO-DO" will be ranked considering these aspects and will be worked into periods of the day.</p>

<a href="{% url 'registration_register' %}" class="btn btn-lg btn-default">Join Today!</a>

Expand Down Expand Up @@ -40,7 +40,7 @@ <h4>Amos Bolder</h4>
<div>
<h4>Claire Gatenby</h4>
<div><img src="{% static 'neuropy/Claire.jpg' %}" class="img-responsive" style="width:100%" alt="Image"></div>
<div>I am a born and bred Australian who made the wild decision to quit my job and move to Seattle where I am learning how to code. I dream of using my past life as a scientist and my new skills as a developer to move into bioinformatics. I love cats, staying active, travelling, the outdoors and taking photos. I am Python developer.</div>
<div>I am a born and bred Australian who made the wild decision to quit my job and move to Seattle where I am learning how to code. I dream of using my past life as a scientist and my new skills as a developer to move into bioinformatics. I love cats, staying active, traveling, the outdoors and taking photos. I am Python developer.</div>
</div>
</div>
<div class="col-sm-3">
Expand All @@ -54,7 +54,7 @@ <h4>Patrick Saunders</h4>
</div>
<div class="row">
<div class="col-sm-5"></div>
<div class="col-sm-6"><img src="../static/neuropy/icon.png\" class="img-responsive">
<div class="col-sm-6"><img src="{% static 'neuropy/icon.png' %}" class="img-responsive">
</div>
</div>

Expand Down
81 changes: 80 additions & 1 deletion neuropy/todo/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from django.test import TestCase, Client, RequestFactory
from django.urls import reverse_lazy

from todo.views import create_event_list
from todo.models import Todo
from userprofile.models import Profile
import factory
from bs4 import BeautifulSoup
import datetime


class TodoFactory(factory.django.DjangoModelFactory):
Expand Down Expand Up @@ -120,6 +122,30 @@ def setUp(self):
self.users = [UserFactory.create() for i in range(20)]
self.todos = [TodoFactory.create() for i in range(20)]

def generate_todos(self):
"""Generate todos."""
user = self.users[5]
todo1 = self.todos[0]
todo2 = self.todos[2]
todo1.owner, todo2.owner = user.profile, user.profile

todo1.date = datetime.date.today()
todo2.date = datetime.date.today()

todo1.ease = 1
todo2.ease = 2

todo1.priority = 2
todo2.priority = 3

todo1.duration = 1
todo2.duration = 2

user.save()
todo1.save()
todo2.save()
return user.profile, [todo1, todo2]

def make_user_and_login(self):
"""Make user and login."""
add_user_group()
Expand All @@ -144,7 +170,6 @@ def test_todo_list_route_is_status_ok(self):
response = self.client.get(reverse_lazy("list_todo"))
self.assertTrue(response.status_code == 200)

def test_todo_list_route_uses_right_templates(self):
"""Test todo list returns the right templates."""
self.client.force_login(self.users[0])
response = self.client.get(reverse_lazy("list_todo"))
Expand Down Expand Up @@ -435,6 +460,60 @@ def test_edit_todo_saves_db_and_shows_to_detail_todo_view(self):
self.assertTrue('<p><strong>Duration: </strong>3</p>' in html)
self.assertTrue('<p><strong>Description: </strong>Then Buy 7/11</p>' in html)

def test_todo_ease_level_is_correct(self):
"""Test todo ease level is correct."""
profile, todos = self.generate_todos()
todos = create_event_list("CONCERTA", profile)
self.assertTrue(len(todos) == 2)

def test_todo_is_in_order(self):
"""Test todo is arranged in right order."""
profile, todo_lst = self.generate_todos()
todos = create_event_list("CONCERTA", profile)
self.assertTrue(todos[0]['title'] == todo_lst[1].title)
self.assertTrue(todos[1]['title'] == todo_lst[0].title)

def test_todos_are_correct_ease_level(self):
"""Test todo is assigned to correct ease levels."""
profile, todo_lst = self.generate_todos()
todos = create_event_list("CONCERTA", profile)
self.assertTrue(todos[0]['ease'] == 'hard')
self.assertTrue(todos[1]['ease'] == 'medium')

def test_todo_created_on_profile_on_wrong_date(self):
"""Test todo is created for current date."""
user = self.users[5]
todo1 = self.todos[0]
todo2 = self.todos[2]
todo1.owner, todo2.owner = user.profile, user.profile

todo1.date = datetime.date(1, 2, 3)
todo2.date = datetime.date(1, 2, 3)

todo1.ease = 1
todo2.ease = 2

todo1.priority = 2
todo2.priority = 3

todo1.duration = 1
todo2.duration = 2

user.save()
todo1.save()
todo2.save()

events = create_event_list('CONCERTA', user.profile)
self.assertFalse(events)

def test_todo_duration(self):
"""Test todo duration is equal to diff between end and start time of todo."""
profile, todo_lst = self.generate_todos()
todos = create_event_list("CONCERTA", profile)
diff_todos_1 = todos[1]['end'] - todos[1]['start']
self.assertTrue(datetime.timedelta(hours=todo_lst[0].duration) == diff_todos_1)


def test_logged_out_todo_fails(self):
"""Test that a logged out user cannot create a todo."""
response = self.client.get(reverse_lazy('add_todo'))
Expand Down