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

🐛 (admin) mark unpublished charts as drafts #3923

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

sophiamersmann
Copy link
Member

@sophiamersmann sophiamersmann commented Sep 4, 2024

  • Fixes a regression in the admin where unpublished charts weren't marked as "draft" in the admin's chart list
  • This happened because the admin expected isPublished to be a boolean when really it was a string value that is either "true" or "false"
  • This went unnoticed before having full configs because isPublished used to be either null (falsy) or "true" (truthy)
  • I'm a bit surprised that these are parsed as strings by knex, maybe there is a deeper issue to fix? The db looks fine though, as far as I can see

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @sophiamersmann and the rest of your teammates on Graphite Graphite

@sophiamersmann sophiamersmann marked this pull request as ready for review September 4, 2024 09:38
@owidbot
Copy link
Contributor

owidbot commented Sep 4, 2024

Quick links (staging server):

Site Admin Wizard

Login: ssh owid@staging-site-fix-admin-drafts

SVG tester:

Number of differences (default views): 0 ✅
Number of differences (all views): 0 ✅

Edited: 2024-09-04 09:46:16 UTC
Execution time: 1.16 seconds

Copy link
Contributor

@danyx23 danyx23 left a comment

Choose a reason for hiding this comment

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

Probably the nicer way to do this is to change how isPublished is queried in the oldChartFieldList so that it works like hasMapTab. The reason for this behaviour is that we don't have json auto-parsing enabled in mysql2 so if you query a json value we get it's string representation that we manually have to query. The JSON_EXTRACT(chart_configs.full, "$.hasChartTab") = true AS hasChartTab clause (could also be done with ->> though of course) then makes sure that the value we get from mysql is a boolean and them mysql2 can just give back that boolean

@sophiamersmann
Copy link
Member Author

ah yes, that makes a lot of sense. i was really confused by this

@sophiamersmann sophiamersmann merged commit c33fc73 into master Sep 4, 2024
21 checks passed
@sophiamersmann sophiamersmann deleted the fix-admin-drafts branch September 4, 2024 14:33
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.

3 participants