Skip to content

Commit

Permalink
TN-3180 eliminate redundant EMPRO_STUDY_ID constant in favor EMPRO_RS…
Browse files Browse the repository at this point in the history
…_ID (#4233)
  • Loading branch information
pbugni authored Aug 12, 2022
1 parent 8e515ab commit 0fadb5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions portal/trigger_states/empro_states.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
from ..models.questionnaire_bank import QuestionnaireBank
from ..models.questionnaire_response import QuestionnaireResponse
from ..models.observation import Observation
from ..models.research_study import EMPRO_RS_ID
from ..models.user import User
from ..timeout_lock import TimeoutLock

EMPRO_STUDY_ID = 1
EMPRO_LOCK_KEY = "empro-trigger-state-lock-{user_id}"


Expand Down Expand Up @@ -317,7 +317,7 @@ def process_pending_actions(ts):
# Withdrawn users should never receive reminders, nor staff
# about them.
qb_status = QB_Status(
user=patient, research_study_id=EMPRO_STUDY_ID, as_of_date=now)
user=patient, research_study_id=EMPRO_RS_ID, as_of_date=now)
if qb_status.withdrawn_by(now):
triggers = copy.deepcopy(ts.triggers)
triggers['action_state'] = 'withdrawn'
Expand Down
5 changes: 2 additions & 3 deletions portal/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from ..models.qb_timeline import QB_StatusCacheKey, invalidate_users_QBT
from ..models.questionnaire_response import QuestionnaireResponse
from ..models.relationship import Relationship
from ..models.research_study import EMPRO_RS_ID
from ..models.role import ROLE, Role
from ..models.table_preference import TablePreference
from ..models.url_token import url_token
Expand Down Expand Up @@ -962,8 +963,6 @@ def delete_user_consents(user_id):
- ServiceToken: []
"""
from portal.trigger_states.empro_states import EMPRO_STUDY_ID

current_app.logger.debug('delete user consent called w/: {}'.format(
request.json))
user = get_user(user_id, 'edit')
Expand All @@ -983,7 +982,7 @@ def delete_user_consents(user_id):
abort(404, "matching user consent not found")

audit_comment = 'Deleted consent agreement'
if research_study_id == EMPRO_STUDY_ID:
if research_study_id == EMPRO_RS_ID:
audit_comment = 'Deleted EMPRO consent agreement'
remove_uc.deleted = Audit(
user_id=current_user().id, subject_id=user_id,
Expand Down

0 comments on commit 0fadb5d

Please sign in to comment.