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

2.11.1 #831

Merged
merged 4 commits into from
Apr 23, 2024
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
46 changes: 46 additions & 0 deletions migrations/versions/51de7be0564a_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""empty message

Revision ID: 51de7be0564a
Revises: 3b95f1f53d17
Create Date: 2024-04-22 17:26:44.675531

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '51de7be0564a'
down_revision = '3b95f1f53d17'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('praktici_kapacity', schema=None) as batch_op:
batch_op.add_column(sa.Column('aktivni', sa.Boolean(), nullable=True))

op.execute("UPDATE praktici_kapacity SET aktivni = coalesce(praktici_kapacity.expirace > now(), true) and pocet_davek > 0")

with op.batch_alter_table('praktici_kapacity', schema=None) as batch_op:
batch_op.alter_column('aktivni', nullable=False)

with op.batch_alter_table('praktici_login', schema=None) as batch_op:
batch_op.add_column(sa.Column('neregistrovani', sa.Boolean(), nullable=True))

op.execute("UPDATE praktici_login SET neregistrovani = False")

with op.batch_alter_table('praktici_login', schema=None) as batch_op:
batch_op.alter_column('neregistrovani', nullable=False)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('praktici_login', schema=None) as batch_op:
batch_op.drop_column('neregistrovani')

with op.batch_alter_table('praktici_kapacity', schema=None) as batch_op:
batch_op.drop_column('aktivni')
# ### end Alembic commands ###
1 change: 1 addition & 0 deletions scripts/create_static_pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if [ $wget_res -ne 0 ]; then
fi

find $WEB_DIR -name "*.html" -type f -delete

cp -r ${WEB_TMP_DIR}/127.0.0.1:5000/* ${WEB_DIR}/
rm -r $WEB_TMP_DIR

Expand Down
14 changes: 11 additions & 3 deletions scripts/create_static_pages_offers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,26 @@ WEB_DIR="/home/ockovani/prd/web/ockovani-covid-pages"

mkdir -p $WEB_TMP_DIR

wget -P $WEB_TMP_DIR -e robots=off --adjust-extension http://127.0.0.1:5000/nabidky
wget -r -P $WEB_TMP_DIR -e robots=off --adjust-extension -l 2 -I /nabidky,/praktik,/okres,/kraj http://127.0.0.1:5000/nabidky
wget_res=$?

if [ $wget_res -ne 0 ]; then
rm -r $WEB_TMP_DIR
exit $wget_res
fi

cp ${WEB_TMP_DIR}/nabidky.html ${WEB_DIR}/
wget -P $WEB_TMP_DIR/127.0.0.1:5000 -e robots=off --adjust-extension http://127.0.0.1:5000/praktici
wget_res=$?

if [ $wget_res -ne 0 ]; then
rm -r $WEB_TMP_DIR
exit $wget_res
fi

cp -r ${WEB_TMP_DIR}/127.0.0.1:5000/* ${WEB_DIR}/
rm -r $WEB_TMP_DIR

cd $WEB_DIR || exit 1
git add *
git commit -am "Update"
git commit -am "Update offers"
git push origin master
12 changes: 8 additions & 4 deletions scripts/cron
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# daily fetcher
30 6 * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 15481697
# hourly fetcher
30 7-22 * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 15481698
20 6 * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 15481697

# hourly fetcher - disabled, centers probably don't update that often
# 30 7-22 * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 15481698

# monthly fetcher
00 5 5 * * bash /home/ockovani/prd/app/scripts/execute_action.sh 16635318

# update GP page
1/5 * * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 94783487
2/5 * * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 94783487

# post tweet - disabled
# 35 7 * * * bash /home/ockovani/prd/app/scripts/execute_action.sh 6797956