-
Notifications
You must be signed in to change notification settings - Fork 52
Feature/international days #210
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
Merged
yammesicka
merged 46 commits into
PythonFreeCourse:develop
from
liaarbel:Feature/International_days
Feb 23, 2021
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
231bbc6
added functions to add data to the db, added fronted and added the th…
liaarbel 74e36f3
added get data from database function
liaarbel 3a40b06
finished international days functionality and start with testing
liaarbel a4f7a80
move .idea to gitignore
liaarbel fae7d17
merged
liaarbel ac23d01
merged
liaarbel af49910
added tests and templates not connected to the full project
liaarbel 5c6695b
merged
liaarbel a511898
create client side to international days feature
liaarbel 9857b9b
changed fronted message
liaarbel db8e55b
deleted css styles
liaarbel 7dd4ec4
reformat code
liaarbel 1054fe4
reformatted code
liaarbel e3d4b74
reformatted code
liaarbel 2e9a0c1
formatted json, changed name of a function, and delete unused file
liaarbel 9055936
changed function name in tests
liaarbel 4952b96
change load data by 'json_data_loader', little changes in the fronted…
liaarbel 5a52693
merged
liaarbel 6996280
reformatted code
liaarbel e32f592
changed typing
liaarbel e2c6d8a
changed from Optional to Union
liaarbel 593e1c2
install requirements
liaarbel 09c2a17
reformatted json
liaarbel 21ec125
typing changes
liaarbel 227117d
changed typing convert
liaarbel 39914e5
changed typing convert
liaarbel 136b353
changed month get
liaarbel 80d1f52
changed test input
liaarbel f31eefa
merged
liaarbel 24b54ef
deleted styles
liaarbel ac7db28
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
liaarbel 2892180
added tests for every international day, reformatted and change funct…
liaarbel 95a1c73
reformatted
liaarbel 84d2742
reformatted2
liaarbel 1ae4836
fixed test
liaarbel ebbbe18
fixed test
liaarbel 4408939
reformatted files
liaarbel b7bc835
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
liaarbel 0e10d53
merged
liaarbel a504708
merged
liaarbel a897d93
fixed tests, changed functions name and ordered files.
liaarbel 1610068
deleted unused function
liaarbel 355468a
changed order of days in json, test in every day exist international …
liaarbel fb60031
fixed and reordered import
liaarbel d69c3a5
Merge branch 'develop' of https://github.com/PythonFreeCourse/calenda…
liaarbel 0ea7a0b
fixed and reordered import
liaarbel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
dev.db | ||
test.db | ||
.idea | ||
config.py | ||
|
||
# Byte-compiled / optimized / DLL files | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from datetime import datetime | ||
from typing import Optional, Dict, Union | ||
|
||
from sqlalchemy.orm import Session | ||
from sqlalchemy.sql.expression import func | ||
|
||
from app.database.models import InternationalDays | ||
|
||
|
||
def get_international_day( | ||
international_day: Dict[str, Union[str, int]] | ||
) -> InternationalDays: | ||
"""Returns an international day object from the dictionary data. | ||
|
||
Args: | ||
international_day: A dictionary international day | ||
related information. | ||
|
||
Returns: | ||
A new international day object. | ||
""" | ||
return InternationalDays( | ||
day=international_day["day"], | ||
month=international_day["month"], | ||
international_day=international_day["international_day"], | ||
) | ||
|
||
|
||
def get_international_day_per_day( | ||
session: Session, date: datetime | ||
) -> Optional[InternationalDays]: | ||
day_num = date.day | ||
month = date.month | ||
international_day = (session.query(InternationalDays) | ||
.filter(InternationalDays.day == day_num) | ||
.filter(InternationalDays.month == month) | ||
.order_by(func.random()) | ||
.first() | ||
) | ||
return international_day |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.