Skip to content

Commit

Permalink
Remove unnecessary casts now that fields are JSONB
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiefMaster committed May 17, 2019
1 parent bc57325 commit 2df4deb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions outlook/indico_outlook/util.py
Expand Up @@ -7,7 +7,6 @@

from __future__ import unicode_literals

from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.orm import joinedload

from indico.core.db import db
Expand Down Expand Up @@ -42,8 +41,7 @@ def get_participating_users(event):
.filter(UserSetting.user_id == Registration.user_id,
UserSetting.module == 'plugin_outlook',
UserSetting.name == 'enabled',
db.func.cast(UserSetting.value, JSONB) == db.func.cast(db.func.to_json(False),
JSONB))
UserSetting.value == db.func.to_jsonb(False))
.correlate(Registration)
.exists())
.join(Registration.registration_form)
Expand Down
3 changes: 1 addition & 2 deletions room_assistance/indico_room_assistance/controllers.py
Expand Up @@ -11,7 +11,6 @@

import dateutil.parser
from flask import request, session
from sqlalchemy.dialects import postgresql
from sqlalchemy.orm import joinedload
from werkzeug.exceptions import Forbidden

Expand All @@ -31,7 +30,7 @@ def _find_requests(from_dt=None, to_dt=None):
.options(joinedload(Request.event))
.filter(Request.type == 'room-assistance',
Request.state == RequestState.accepted,
db.cast(Request.data, postgresql.JSONB).has_key('start_dt'))) # noqa
Request.data.has_key('start_dt'))) # noqa

if from_dt:
query = query.filter(db.cast(Request.data['start_dt'].astext, db.DateTime) >= from_dt)
Expand Down

0 comments on commit 2df4deb

Please sign in to comment.