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

[Topic->Collection] migration issue with relative dates (or an UI inconsistency) #558

Open
zopyx opened this issue Jun 26, 2020 · 0 comments

Comments

@zopyx
Copy link
Member

zopyx commented Jun 26, 2020

We have the following ATFriendlyDateCriteria for filtering by effective for up to 365 days in the past (operation=less).

{'_ac_local_roles': {'dkirchne': ['Owner']}, 
 '_annotations': {}, 
 '_classname': 'ATDateCriteria', 
 '_cmfcore_marker': 'yes', 
 '_content_type': 'text/html', 
 '_content_type_dateRange': 'text/plain', 
 '_content_type_field': 'text/plain', 
 '_content_type_id': 'text/plain', 
 '_content_type_operation': 'text/plain', 
 '_defaultpage': 'base_view', 
 '_directly_provided': [], 
 '_gopip': 0, 
 '_id': 'import/fcc2ad57-01b5-4621-bda6-8fe798f0bb37', 
 '_json_filename': '/home/ajung/content_plone_portal_2020-06-08-12-47-37/6/6330.json', 
 '_key': 'fcc2ad57-01b5-4621-bda6-8fe798f0bb37', 
 '_layout': 'facetednavigation_view', 
 '_meta_type': 'ATFriendlyDateCriteria', 
 '_object_id': 'crit__effective_ATFriendlyDateCriteria', 
 '_owner': 'dkirchne', 
 '_path': '/plone_portal/en/news-events/overview/crit__effective_ATFriendlyDateCriteria', 
 '_paths_all': ['/plone_portal', 
                '/plone_portal/en', 
                '/plone_portal/en/news-events', 
                '/plone_portal/en/news-events/overview'], 
 '_permissions': {}, 
 '_portlets': {}, 
 '_portlets_blacklist': {}, 
 '_properties': [['title', 'News', 'string'], 
                 ['layout', 'facetednavigation_view', 'string']], 
 '_relative_path': 'en/news-events/overview/crit__effective_ATFriendlyDateCriteria', 
 '_rev': '_anPzkQ----', 
 '_type': 'ATDateCriteria', 
 '_ugent_type': 'content', 
 '_uid': None, 
 '_userdefined_roles': [], 
 '_workflow_history': {'ugent_portal_workflow': [{'action': None, 
                                                  'actor': 'xx', 
                                                  'comments': '', 
                                                  'review_state': 'visible', 
                                                  'time': '2016/04/18 ' 
                                                          '16:52:33.380768 ' 
                                                          'GMT+2'}, 
                                                 {'action': 'publish', 
                                                  'actor': 'xx', 
                                                  'comments': '', 
                                                  'review_state': 'published', 
                                                  'time': '2016/04/18 ' 
                                                          '16:56:22.464606 ' 
                                                          'GMT+2'}]}, 
 '_zopeobject_document_src': '', 
 'contributors': [], 
 'creation_date': '2016/04/18 16:52:33.714807 GMT+2', 
 'dateRange': '-', 
 'description': '', 
 'effectiveDate': '', 
 'effective_date': '2016/04/18 15:05:00 GMT+2', 
 'expirationDate': '', 
 'expiration_date': '', 
 'field': 'effective', 
 'hasRelatedItems': False, 
 'id': 'crit__effective_ATFriendlyDateCriteria', 
 'language': '', 
 'modification_date': '2020/05/05 14:24:1.739918 GMT+2', 
 'operation': 'less', 
 'review_state': None, 
 'rights': '', 
 'subject': [], 
 'title': '', 
 'value': 365}

The migration code converts this to lessThanRelativeDate.

https://github.com/plone/plone.app.contenttypes/blob/master/plone/app/contenttypes/migration/topics.py#L265-L274

Recreating the same criteria through UI using "within last..days" produces a query with largerThanRelativeDate.

It is unclear what the correct solution would be. See

https://community.plone.org/t/plone-app-querystring-collection-within-last-n-days-translated-to-largerthanrelativedate/12474/3

The migration seems to do the right things based on the naming of the operator. The UI generates and uses larger... which feels broken from the naming point of view.

@zopyx zopyx changed the title [Topic->Collection] migration issue with relative dates [Topic->Collection] migration issue with relative dates (or an UI inconsistency) Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants