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

(PC-32877)[API] feat: script to fix movie data in products #14933

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions api/src/pcapi/scripts/replace-apostrophe-in-movie-data/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from pcapi.app import app
from pcapi.core.categories import subcategories_v2
from pcapi.core.offers.models import Product
from pcapi.repository import db


with app.app_context():
products = Product.query.filter(Product.subcategoryId == subcategories_v2.SEANCE_CINE.id)
for product in products:
product.description = product.description.replace("'", "\u2019")
if "synopsis" in product.extraData:
product.extraData["synopsis"] = product.extraData["synopsis"].replace("'", "\u2019")

db.session.add(product)

db.session.commit()