Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/weekly tasks #146

Open
wants to merge 43 commits into
base: develop
Choose a base branch
from

Conversation

issac211
Copy link
Contributor

Added tables, routers, tests, templates, and internal functions

The fitter gives the option to set weekly tasks.
Comes with a page for managing weekly tasks and another page for editing the task.
Gives the ability to edit, add and delete a weekly task.

Along with this in the feature is included a function for creating the tasks - which aims to create tasks every week for the user (according to the definition of his weekly tasks)

@codecov-io
Copy link

codecov-io commented Jan 29, 2021

Codecov Report

Merging #146 (925e449) into develop (190a274) will increase coverage by 0.20%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #146      +/-   ##
===========================================
+ Coverage    95.81%   96.01%   +0.20%     
===========================================
  Files           75       77       +2     
  Lines         3343     3515     +172     
===========================================
+ Hits          3203     3375     +172     
  Misses         140      140              
Impacted Files Coverage Δ
app/main.py 92.68% <ø> (ø)
app/database/models.py 97.41% <100.00%> (+0.27%) ⬆️
app/internal/weekly_tasks.py 100.00% <100.00%> (ø)
app/routers/weekly_tasks.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 190a274...925e449. Read the comment docs.

app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
@yammesicka
Copy link
Member

Great work! I've added few of my insights :)

Copy link
Member

@yammesicka yammesicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work! Let's make another little push :)

app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/templates/add_edit_weekly_task.html Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
Copy link
Member

@yammesicka yammesicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement!

app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/templates/add_edit_weekly_task.html Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/templates/add_edit_weekly_task.html Outdated Show resolved Hide resolved
tests/weekly_tasks_fixture.py Outdated Show resolved Hide resolved
tests/weekly_tasks_fixture.py Outdated Show resolved Hide resolved
tests/weekly_tasks_fixture.py Outdated Show resolved Hide resolved
@@ -59,6 +59,20 @@ def profile_test_client():
Base.metadata.drop_all(bind=test_engine)


@pytest.fixture(scope="session")
def weekly_tasks_test_client():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Maybe we should use it in more tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other functions (internal) are not client related functions
so it seems I can't use it on them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#146 (comment)

it seems the comment about the 'Depends(get_db)' encounters the same problem
the Depends is of no use if the function is not a router function.
I did not find a way to use it within a standard non-fastapi function

the internal functions are used by the routers functions which uses Depends

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split the tests into two files: internal tests and route tests.

Tell me what you think about the rearrangement and my comments :)

app/routers/weekly_tasks.py Show resolved Hide resolved
massage = None
if mode == "add":
massage = "could not add The Weekly Task"
made_change = create_weekly_task(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deduplicate and move outside

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

different functions, in the next commits I will change the names and variables to make it clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed the names so it will be more clear, please look again, tell me what you think :)

weekly_task_id=weekly_task_id
)

made_change = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed the names so it will be more clear, please look again, tell me what you think :)

@yammesicka
Copy link
Member

Great work, but we still have a little way to go :)

Copy link
Member

@yammesicka yammesicka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great progress. I love the expansion of the tests.
I've added few insights, please take a look :)

app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
app/database/models.py Show resolved Hide resolved
app/database/models.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
Copy link
Contributor

@IdanPelled IdanPelled left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

app/database/models.py Outdated Show resolved Hide resolved
content = Column(String)
is_done = Column(Boolean, nullable=False)
is_important = Column(Boolean, nullable=False)
date_time = Column(DateTime, nullable=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to give more specific variable names.
is it the creation date, or maybe the deadline, it is hard to tell.

Copy link
Contributor Author

@issac211 issac211 Feb 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should not mess with this model, its not mine

app/internal/weekly_tasks.py Outdated Show resolved Hide resolved
Comment on lines +39 to +44
day = day_full_name[:3]
day_lower = day.lower()
if day in days_list:
checked_days.append((day_full_name, day_lower, "checked"))
else:
checked_days.append((day_full_name, day_lower, ""))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split to functions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not understand

app/routers/weekly_tasks.py Outdated Show resolved Hide resolved
)


@router.get("/add", dependencies=[Depends(is_logged_in)])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add is_logged_in to the router's dependencies instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realized that the function is meant to be used in this way as well.
In case I do not need to use the variable it return's inside the router.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants