bcgov / MFIN-Data-Catalogue

The Finance Data Catalogue enables users to discover data holdings at the BC Ministry of Finance and offers information and functionality that benefits consumers of data for business purposes. The product is built using Drupal and adheres to the Government of BC's Core Metadata Standard.
Other
6 stars 0 forks source link

Metadata published date showing value for date created #418

Closed ChristaBull closed 2 months ago

ChristaBull commented 3 months ago

OP timer

https://openplus.monday.com/boards/4092908516/pulses/6386858588


Describe the bug

The published date displayed on a metadata record is not the date the record was published. Either the label isn't correct (e.g. it should be the created date) or the value isn't correct.

To reproduce

Steps to reproduce the behaviour:

  1. Go to Land Owner Transparency Report Fact record (https://cat.data.fin.gov.bc.ca/land-owner-transparency-report-fact)
  2. Compare with dates shown on revisions tab (https://cat.data.fin.gov.bc.ca/node/75/revisions)

Expected behaviour

If the label stays as "Published Date" the date should align with the date the record was first published.

Screenshots

When viewing record

image

Revisions from Created to Publish The date shown as the published date for the record aligns with the date the first draft was created not the date it was published (initially or last)

image

CraigClark commented 3 months ago

We need to do some thinking on this one. In section 2, there is a field called Publish date. This is a field editors can fill out. If you don't do anything, it will default to the last published date, which is the Drupal default.

The reason we set it manually is to get around situations like:

  1. I publish an MR on 2024-04-01
  2. I correct a typo on 2024-04-03
  3. Drupal shows the publish date as 2024-04-03

Also, we have run into situations in the past where, for whatever reason, clients want to change the date something was published. A manually set date field is a user friendly solution to that.

Christa has found an issue with this approach. Removing bug tag though because it's not broken, it's doing what it was designed to do. Needs to be better designed.

NicoledeGreef commented 3 months ago

@lkmorlan - if the Published date value is not explicitly set by the user, can it display the first date the record was published, not the last date it was published?

lkmorlan commented 3 months ago

We could have some code that sets it to the current date anytime it is published and still blank.

CraigClark commented 3 months ago

@lkmorlan that's what it does now.

Can we have it be the first published date if it is left blank? So:

I published and set a date

  1. Set date to 2024-04-01
  2. The date is always 2024-04-01 unless I change it, no matter how many published revisions there are (it does this now)

Can we do: I publish and do not set a date

  1. The first published revision I do is on 2024-04-01
  2. I publish another revision on 2024-01-05 and do not touch the field
  3. The published date stays 2024-04-01 and stays that way no matter how many published revisions there are over time.
  4. The only way it can change is if I set the field value.

Currently this is what happens if I do not enter a value

  1. I published a record on 2024-04-01
  2. I publish a revision on 2024-04-05
  3. The published date on the record now says 2024-04-05
lkmorlan commented 3 months ago

I'm sure it is possible. I would have to look in more detail at what the code is doing to know exactly what to do.

lkmorlan commented 2 months ago

Currently, field_published_date is a required field with a default of now, so it has a value from the moment of creation as a draft. It has no special behaviour.

Now in branch 418-published_date, it is not required and has no default. On publish, if it is empty, it it set to now. So, a draft can have it empty or set but a published recall will always have it set, either manually or automatically. Does this do what is needed?

lkmorlan commented 2 months ago

I have set it so that field_published_date is not required and has no default. On publish, if it is empty, it it set to now. So, a draft can have it empty or set but a published recall will always have it set, either manually or automatically.

NicoledeGreef commented 2 months ago

Reviewed in dev.

Image