Skip to content
Draft
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
39 changes: 39 additions & 0 deletions alembic/versions/786584a43a32_added_newsflash_features.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Added newsflash features

Revision ID: 786584a43a32
Revises: 10023013f155
Create Date: 2021-02-24 21:00:01.883726

"""

# revision identifiers, used by Alembic.
revision = '786584a43a32'
down_revision = '10023013f155'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_unique_constraint(None, 'news_flash', ['id'])
op.create_table('newsflash_features',
sa.Column('id', sa.BigInteger(), nullable=False),
sa.Column('newsflash_id', sa.BigInteger(), nullable=True),
sa.Column('version', sa.Integer(), nullable=False),
sa.Column('timestamp', sa.DateTime(), nullable=False),
sa.Column('is_urban', sa.Boolean(), nullable=True),
sa.ForeignKeyConstraint(['newsflash_id'], ['news_flash.id'], ),
sa.PrimaryKeyConstraint('id')
)

# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('newsflash_features')
op.drop_constraint(None, 'news_flash', type_='unique')
# ### end Alembic commands ###
13 changes: 7 additions & 6 deletions anyway/flask_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1592,13 +1592,14 @@ def infographics_data():
number_of_years_ago = request.values.get("years_ago", BE_CONST.DEFAULT_NUMBER_OF_YEARS_AGO)
lang: str = request.values.get("lang", "he")
logging.debug(
("getting infographics data for news_flash_id: {news_flash_id}, " +
"in time period:{number_of_years_ago}, lang:{lang}").format(
news_flash_id=news_flash_id, number_of_years_ago=number_of_years_ago,
lang=lang
)
(
"getting infographics data for news_flash_id: {news_flash_id}, "
+ "in time period:{number_of_years_ago}, lang:{lang}"
).format(news_flash_id=news_flash_id, number_of_years_ago=number_of_years_ago, lang=lang)
)
output = get_infographics_data(
news_flash_id=news_flash_id, years_ago=number_of_years_ago, lang=lang
)
output = get_infographics_data(news_flash_id=news_flash_id, years_ago=number_of_years_ago, lang=lang)
if not output:
log_bad_request(request)
return abort(http_client.NOT_FOUND)
Expand Down
Loading