Skip to content

Commit

Permalink
Bring bugfixes from main into gdx-dev (#2328)
Browse files Browse the repository at this point in the history
* Made slug url case insensitive , Fixed bug with wrong query join for submission (#2321)

* Made slug url case insensitive ,
Fixed bug with wrong query join for submission

* removed a couple of if statements

* CSV export made working for multipage wizard surveys (#2322)

---------

Co-authored-by: saravanpa-aot <[email protected]>
  • Loading branch information
NatSquared and saravanpa-aot authored Oct 26, 2023
1 parent 1e6dc2b commit a3af416
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
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

0 comments on commit a3af416

Please sign in to comment.