Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Time series form bug #275

Closed
davidread opened this issue Dec 14, 2015 · 9 comments
Closed

Time series form bug #275

davidread opened this issue Dec 14, 2015 · 9 comments

Comments

@davidread
Copy link
Contributor

From James:

I've changed the dataset below into a time-series, but its acting weird:
https://data.gov.uk/dataset/financial-transactions-spend-data-bis

4 of the data resources have been moved out of the time-series and won't go back in.
@rossjones rossjones self-assigned this Dec 14, 2015
@rossjones
Copy link
Contributor

Once a dataset gets in this state, with mostly timeseries, and some individual resources it is no longer editable because validation stops you using two different resource types.

Reseting to single entries, and then back to timeseries, it isn't straight-forward to replicate.

@rossjones
Copy link
Contributor

I can't replicate this, but I have written a tool to fix the situation.

Once a dataset gets in this state, trying to save it will cause problems as they don't show up in the time-series editor, and then cause a validation error (because it has both resource types).

I've been unable to find out why this happened, and presumably nothing strange happened during the editing? I think this is a positive reason for having bug-reports direct from the person who experienced it.

When going to the edit form, if we have time-series resources, then any individual_resources should be added to the bottom of the form. This will cause a validation error as the date field will be empty for these resources. But this is better than having hidden resources that stop you from editing.

@davidread
Copy link
Contributor Author

any individual_resources should be added to the bottom of the form

I just tried this on https://data.gov.uk/dataset/edit/financial-transactions-spend-data-bis#tab-data and it doesn't seem to be the case. Is this a PR you are preparing or haven't deployed yet?

@davidread
Copy link
Contributor Author

Ah, i just read you again - "should" as in a proposal, not something done. Sounds good!

@rossjones
Copy link
Contributor

Adding the individual_resources in the timeseries table is straight-forward, in most cases the list will be empty, but when it isn't, it fills them in waiting for a date.

However because the individual_resources are not [], the table is rendered with the data (but hidden) and causes a validation error.

rossjones added a commit that referenced this issue Dec 17, 2015
In cases where something has gone terribly wrong, we may end up with a
tiemseries dataset, but with some individual_resources.  This will cause
a validation error.

When this occurs, if we are in timeseries mode, we will include the
individual_resources in the timeseries table so that the validation
error is missing date, rather than a mixed resource type warning.  We
also do not populate the invidual_resource table, it will be sorted out
on the client if we switch back, but adding it will trigger the wrong
validation again.
@rossjones
Copy link
Contributor

This has been solved by some template-magic, and needs review.

@rossjones rossjones removed their assignment Dec 17, 2015
davidread pushed a commit that referenced this issue Dec 18, 2015
…package-edit

Fixes #275 by importing individual resources into timeseries table.
@davidread davidread reopened this Dec 18, 2015
@davidread
Copy link
Contributor Author

The workaround #292 is great, but I think I've recreated the problem now.

  1. Create a dataset with two normal resources.
  2. Edit it, change it to timeseries and add a date to both resources, and edit the description of the first resource only.
  3. Save it and notice that the 2nd resource has not had the date attached.

There seems to be something in the resource saving stuff that only saves the resource if it has changed. However it ignores the date column. So if only the date has changed it doesn't save it.

@davidread
Copy link
Contributor Author

Found the fix on master ckan/ckan#2158

@davidread
Copy link
Contributor Author

All deployed and BIS dataset saved ok.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants