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

Check accrualPeriodicity against list of valid frequency values. #3021

Merged
merged 3 commits into from
Feb 20, 2020

Conversation

beeyayjay
Copy link

Checks the validity of the accrualPeriodicity field in prepareRow().

User story

If a json harvest has an accrualPeriodicity value, that value gets saved to the frequency field, even if the value isn't valid for the field.

The pr adds a check to prepare row. If the value is a valid key value for field_frequency, there is no change. If it is a valid display value, it is set to the key value. If it is neither, it is set to null.

How to reproduce

  1. Run a harvest against a harvest cache with an invalid value for accrualPeriodicity.
  2. Browse to the dataset page. The invalid value will be displayed as the frequency.
  3. Edit the page. The select value for the frequency field will be set to '- None -'.

QA Steps

  1. Create/modify three harvest cache files with accrualPeriodicity fields.
    a. Give one a valid Frequency key (e.g. R/P1D).
    b. Give another a valid Frequency value (e.g. Daily).
    c. Give the third an invalid value
  2. Run the harvest.
  3. Check the harvested datasets. Frequency should appear with its correct value for the first two on both the dataset page and its edit form. Frequency should not appear on the dataset page for the third.

@beeyayjay
Copy link
Author

Wait on this. I just realized the code probably belongs in dkan_migrate_base_data_json.inc instead.

Copy link
Member

@janette janette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@beeyayjay since this is specific to POD endpoints could you put the code in here https://github.com/GetDKAN/dkan/blob/7.x-1.x/modules/dkan/dkan_harvest/modules/dkan_harvest_datajson/dkan_harvest_datajson.migrate.inc#L81 and add a message for the log when an invalid value is detected and ignored.

@janette janette merged commit e5c03e5 into 7.x-1.x Feb 20, 2020
@janette janette deleted the harvest-frequency-check branch February 20, 2020 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants