Skip to content

Added search feature #98

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
merged 41 commits into from
Jan 27, 2021
Merged

Conversation

advaa123
Copy link
Contributor

No description provided.

@advaa123 advaa123 changed the base branch from main to develop January 20, 2021 10:34
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 job! Please see my insights above :)

""")

# PostgreSQL
event.listen(Event.__table__, 'after_create', trigger_snippet.execute_if(dialect='postgresql'))
Copy link
Member

Choose a reason for hiding this comment

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

Awesome

@yammesicka yammesicka closed this Jan 21, 2021
@yammesicka yammesicka deleted the branch PythonFreeCourse:develop January 21, 2021 02:36
@yammesicka yammesicka reopened this Jan 21, 2021
@advaa123 advaa123 changed the title WIP - added search feature Added search feature Jan 21, 2021
@advaa123 advaa123 requested a review from yammesicka January 21, 2021 10:31
app/main.py Outdated


models.Base.metadata.create_all(bind=engine)
if 'sqlite' in str(engine.url) and PSQL_ENVIRONMENT:
raise models.PSQLEnvironmentError(
Copy link
Member

Choose a reason for hiding this comment

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

Excellent!

@@ -6,6 +6,8 @@ from fastapi_mail import ConnectionConfig

# DATABASE
DEVELOPMENT_DATABASE_STRING = "sqlite:///./dev.db"
# Set the following True if working on PSQL environment or set False otherwise
PSQL_ENVIRONMENT = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you want to add it as env value?

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 considered it and chose otherwise, thank you!

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be happy to hear why :)

# PostgreSQL
if PSQL_ENVIRONMENT:
trigger_snippet = DDL("""
CREATE TRIGGER ix_events_tsv_update BEFORE INSERT OR UPDATE
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider save the query content in other file (probably const)

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 thought keeping it there would make it easier for other programmers to understand the code, do you think otherwise?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think a good variable name (and maybe a short description) will explain the essence more than the how (the query itself), what do you think?

from app.config import PSQL_ENVIRONMENT
from app.database.database import Base
from sqlalchemy import (DDL, Boolean, Column, DateTime, ForeignKey, Index,
Integer, String, event)
Copy link
Contributor

Choose a reason for hiding this comment

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

Where do you use event?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

event.listen(.....)


@router.post("/search")
async def show_results(request: Request, keywords: str = Form(None), db: Session = Depends(get_db)):
current_username = "Chuck Norris"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be nice to add a TODO comment here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do!

@@ -11,11 +11,12 @@
from sqlalchemy.orm import sessionmaker
pytest_plugins = "smtpdfix"

SQLALCHEMY_TEST_DATABASE_URL = "sqlite:///./test.db"
SQLALCHEMY_TEST_DATABASE_URL = "postgresql://postgres:1234@localhost/postgres"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please explain why?

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 full-text search feature works on a PSQL environment only.

Copy link
Contributor

Choose a reason for hiding this comment

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

So maybe you could do the same trick as you did for the app environment? :)

@yammesicka
Copy link
Member

Could you please merge develop into your code? :)
It would make it easier for me to follow the changes.

@codecov-io
Copy link

codecov-io commented Jan 24, 2021

Codecov Report

Merging #98 (e8f067d) into develop (0b4570b) will decrease coverage by 0.58%.
The diff coverage is 93.44%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #98      +/-   ##
===========================================
- Coverage   100.00%   99.41%   -0.59%     
===========================================
  Files           17       19       +2     
  Lines          628      684      +56     
===========================================
+ Hits           628      680      +52     
- Misses           0        4       +4     
Impacted Files Coverage Δ
app/database/models.py 93.44% <66.66%> (-6.56%) ⬇️
app/database/database.py 100.00% <100.00%> (ø)
app/internal/search.py 100.00% <100.00%> (ø)
app/main.py 100.00% <100.00%> (ø)
app/routers/search.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 0b4570b...e8f067d. Read the comment docs.

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 PR :) Just remove the settings.json files and reformat the indentation :)

@advaa123 advaa123 requested a review from yammesicka January 26, 2021 07:43
@yammesicka yammesicka merged commit 1ee995b into PythonFreeCourse:develop Jan 27, 2021
yammesicka added a commit that referenced this pull request Feb 5, 2021
* update ORM and added export for an event

* update ORM and added export for an event

* Added in app shareable events

* docs: add type annotation and fix folder structure

* docs: add type annotation and fix folder structure

* docs: fix documentation

* feat: get weather forecast for date and location

* feat: get weather forecast for date and location

* add: tests

* set up commit

* add: timezone support

* add: session management

* fix bug

* split conftest file

* split conftest file

* move "utils" folder into "internal" folder

* working day view with jinja2 template

* with tests for pytest

* feat: get weather forecast - fixes according to requested changes.

* change file structure

* feat: get weather forecast - fixes according to requested changes.

* first functioning day-view html, css and router

* feat: Basic responsive calender day view page

Added dayview template with css and router.
An tempreroy event class with,
 processing function for the day view to work.

* feat: Basic responsive calender day view page

Added dayview template with css and router.
An tempreroy event class with,
 processing function for the day view to work.
fixed after taking notes.

* fix lint now for sure

* more lint

* feat: get weather forecast - fix requirements.txt

* feat: enable invited users to view events

* feat: flake8 changes

* fix: requirements bug

* fix: requirements bug

* feat: flake8 changes

* add: tests

* feat: flake8 changes

* add: tests

* feat: flake8 changes

* edit: file structure

* edit: file structure

* feat: get weather forecast - fix changes & add cache support

* feat: get weather forecast - fix changes & add cache support

* feat: get weather forecast - fix changes & add cache support

* feat: add route tests

* feat: get weather forecast - fix changes & add cache support

* feat: get weather forecast - fix changes & add cache support

* fix: test bug

* remove: config.py

* after all notes and started use the orm

* fix: type annotation

* feat: get weather forecast - add API mocking

* feat: get weather forecast - add API mocking

* feat: get weather forecast - add API mocking

* feat: get weather forecast - add API mocking

* fixed: changed "size" var in html and and more acuurate typing

* deleted some testing lines

* add requirements missing

* add: minor changes

* feat: flake8 changes

* @hadaskedar2020

* feat: get weather forecast - add API mocking

* feat: weather forecast - add API mocking & improve coverage

* feat: weather forecast - add API mocking & improve coverage

* feat: weather forecast - add API mocking & improve coverage

* feat: weather forecast - add API mocking & improve coverage

* feat: weather forecast - add API mocking & improve coverage

* fixed: statements of event select more accurate

* new test and lint fix

* added more contants abd more notes taken

* feat: weather forecast - move feat to internal

* Delete Scripts directory

* update constants

* more notes

* forgot white space

* feat: gets a link to the suitable image of a given event content. (#70)

* feat: gets a link to the suitable image of a given event content.

* Add basic update event (#100)

* Add basic update event

* Added search feature (#98)

* Added search feature

* Add telegram client (#111)

Add telegram client

* feat: Add a feature for sharing information with a WhatsApp account (#83)

* feat: Add a feature to share to a WhatsApp account

* Feature/logging system (#112)

* feat: first logging commit

Co-authored-by: Liad Noam <[email protected]>

* feat: add a daily inspirational quote (#128)

* feat: add a daily inspirational quote

* Feature/delete event (#139)

* basic delete event

* Add an event delete function

* Fix flake8

* Deleting an unnecessary model

* Extract lines from try

* fix: modify psycopg2 dependency (#164)

* Bugfix/logging system (#158)

* Changed logging config to be received by separate parameters for simplicity, removed option to receive configuration as a dict, added .vscode to gitignore

* removed logging_config file which is no longer needed

* Fixing merge conflicts - missing whitespace on config.py.example

Co-authored-by: Liad Noam <[email protected]>

* Added checking for zoom link and saving the event (#122)

* Added checking for zoom link and saving the event

* Feature/import to calendar (#119)

* feat: import file to calendar

* docs: adding community standard documents (#173)

* Feat: Event View Backend (#159)

* Moved the route to top of file

* Feature/send email (#88)

* Added files for sending invitations by email

This includes
- templates
- routes and internal code
- configuration
- tests

Co-authored-by: leddest <[email protected]>
Co-authored-by: Ellen <[email protected]>

* Feature/translation - add an functionality to translate event data etc. (#167)

* translation feature stuff

* Update event - Improving the code (#138)

* Add basic update event

* Support categories for events (#137)

* Support categories for events

* Style/grid (#106)

* Hello Wrold

* Creating Html Template

* Calendar dates calculation intigrating with html, HTML\CSS improvments.

* Tests for calender_grid.py, changing function according to currections, fixing bugs

* linting bug fixing

* before merge with develop

* Creating a Day object and days subclasses, changing all function and tests according to the new objects, Changing front to get information from Day objects, Re-arranging  calendar.html grid stracture to be render by weeks, adding js functionality for day view section, adding css effects on daily event display

* fix lintings

* fix lintings

* tests next week scroll

* js updates

* Calendar Scrolling with javascript

* Fix lintings

* Fix lintings

* Calendar infinit scrolling ducplicates weeks bug fixed

* seetings global parameters for calendar.py

* Js - changing to fetch, removing jquery, fixing hint tpying, adding Week object, changing tests

* Front end bug fixing

* Fix linting

* Fix lintings

* Fix lintings

* fixing syntax

* Get user local date and time when enter calendar.

* Fix lintings

* Fix lintings

* Fix lintings

* Bugs fixing

* Bugs fixing

* Bugs fixing

* Bugs fixing

* JS alerts removal

* Fix Lintings

* Js syntext fixing

* Bugs fixing

* Bugs fixing

* Js fixing varibales and adding div element to request.

* Develop Update

* Js - eliminate global parameters

* Linting fixing

* Fix Lintings

* Fix flake8

* syntac fixing

* Feature/translations workflow (#150)

* feat: add translations workflow

* fix(translations-workflow): fix doc

* fix(translations-workflow): fixed code and added automatic commit

Co-authored-by: Gonny <1@1>

* Revert "Feature/translations workflow (#150)" (#208)

This reverts commit 2e6a2c2.

* feat: Add zodiac signs to the day & month view + refactor json data loader (#155)

* feat: Add zodiac signs to the day/month view +

* Change calendar link from '#' to '/' to get the home page (#194)

when clicking on the logo

* Style/grid (#200)

* Js scrolling duplication days fixed

Co-authored-by: Idan Pelled <[email protected]>
Co-authored-by: Hadas Kedar <[email protected]>
Co-authored-by: Sagi Zaid Or <[email protected]>
Co-authored-by: sagizaidor <[email protected]>
Co-authored-by: hadaskedar2020 <[email protected]>
Co-authored-by: nir9696 <[email protected]>
Co-authored-by: efratush <[email protected]>
Co-authored-by: advaa123 <[email protected]>
Co-authored-by: leddest <[email protected]>
Co-authored-by: nelliei <[email protected]>
Co-authored-by: Liad-n <[email protected]>
Co-authored-by: Liad Noam <[email protected]>
Co-authored-by: zohary89 <[email protected]>
Co-authored-by: Ron Huberfeld <[email protected]>
Co-authored-by: Ap1234567 <[email protected]>
Co-authored-by: Nir-P <[email protected]>
Co-authored-by: Ode <[email protected]>
Co-authored-by: Anna Shtirberg <[email protected]>
Co-authored-by: Ellen <[email protected]>
Co-authored-by: ivarshav <[email protected]>
Co-authored-by: Aviad <[email protected]>
Co-authored-by: Gonzom <[email protected]>
Co-authored-by: Gonny <1@1>
Co-authored-by: YairEn <[email protected]>
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.

4 participants