Skip to content

Commit

Permalink
Revert incorrect api filter fix for prerpint
Browse files Browse the repository at this point in the history
  • Loading branch information
cslzchen committed Jan 9, 2025
1 parent 989ffd5 commit 16574e2
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions api/base/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,39 +291,7 @@ def parse_query_params(self, query_params):
query.get(key).update({
field_name: self._parse_date_param(field, source_field_name, op, value),
})
elif not isinstance(value, int) and source_field_name in ['_id', 'guid._id']:
# TODO: this is broken since value can be a multi-value str separated by comma; in addition,
# as for a single-versioned-guid value, the filter is `or` but we need `and`; this will
# be fixed in [ENG-6878](https://openscience.atlassian.net/browse/ENG-6878).
base_guid, version = Guid.split_guid(value)
if base_guid is None and version is None:
raise InvalidFilterValue(
value=value,
field_type='guid',
)
guid_filters = {
field_name: {
'op': 'in',
'value': self.bulk_get_values(value, field),
'source_field_name': source_field_name,
},
}
if version is not None:
guid_filters = {
field_name: {
'op': 'eq',
'value': base_guid,
'source_field_name': 'versioned_guids___id',
},
'versioned_guids__version': {
'op': 'eq',
'value': version,
'source_field_name': 'versioned_guids__version',
},
}

query.get(key).update(guid_filters)
elif not isinstance(value, int) and source_field_name in ['journal_id', 'moderation_state']:
elif not isinstance(value, int) and source_field_name in ['_id', 'guid._id', 'journal_id', 'moderation_state']:
query.get(key).update({
field_name: {
'op': 'in',
Expand Down

0 comments on commit 16574e2

Please sign in to comment.