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

Bring bugfixes from main into gdx-dev #2328

Merged
merged 2 commits into from
Oct 26, 2023
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
5 changes: 2 additions & 3 deletions met-api/src/met_api/models/comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,12 @@ def get_by_survey_id_paginated(
"""Get submissions by survey id paginated."""
null_value = None
query = db.session.query(Submission)\
.join(Comment, Submission.id == Comment.submission_id)\
.filter(and_(Submission.survey_id == survey_id,
or_(Submission.reviewed_by != 'System', Submission.reviewed_by == null_value)))\
or_(Submission.reviewed_by != 'System', Submission.reviewed_by == null_value)))

if search_text:
# Remove all non-digit characters from search text
query = query.filter(Comment.text.ilike('%' + search_text + '%'))
query = query.filter(Submission.comments.any(Comment.text.ilike('%' + search_text + '%')))

if advanced_search_filters:
query = cls._filter_by_advanced_filters(query, advanced_search_filters)
Expand Down
2 changes: 1 addition & 1 deletion met-api/src/met_api/models/engagement_slug.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class EngagementSlug(BaseModel):
@classmethod
def find_by_slug(cls, slug):
"""Return engagement slug by slug."""
return cls.query.filter_by(slug=slug).first()
return cls.query.filter(cls.slug.ilike(slug)).first()

@classmethod
def find_by_engagement_id(cls, engagement_id):
Expand Down
3 changes: 0 additions & 3 deletions met-api/src/met_api/schemas/engagement.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,6 @@ def get_submission_status(self, obj):
# Strip time off datetime object
date_due = datetime(now.year, now.month, now.day)

print('--date_due-:',date_due)
print('-start_date -:', obj.start_date )
print('--end_date -:', obj.end_date)
if obj.start_date <= date_due <= obj.end_date:
return SubmissionStatus.Open.value

Expand Down
5 changes: 4 additions & 1 deletion met-api/src/met_api/services/comment_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ def get_titles(cls, survey: SurveySchema):
# Title could be dynamic based on the number of comment type questions on the survey
survey_form = survey.form_json
labels = []
for component in survey_form.get('components', []):
components = cls.extract_components(survey_form)
if len(components) == 0:
return []
for component in components:
if component.get('inputType', None) == 'text':
if 'label' in component:
labels.append(component['label'])
Expand Down
Loading