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

[bug] Inconsistent flag rendering in how-tos #3131

Open
darigovresearch opened this issue Dec 31, 2023 · 9 comments
Open

[bug] Inconsistent flag rendering in how-tos #3131

darigovresearch opened this issue Dec 31, 2023 · 9 comments

Comments

@darigovresearch
Copy link
Contributor

Describe the bug
Flags are not all the same for our profile, this could be happening for other users

To Reproduce
Steps to reproduce the behaviour:

  1. Go to here
  2. See the flags on how-tos we've written do not match
  3. or see the screenshot

Expected behaviour
They should all be the same flag

Screenshots
image

Additional context
They should all be the UK flag as we're based in London, UK

@goratt12
Copy link
Collaborator

goratt12 commented Jan 1, 2024

This is happening due the change in the creatorCountry field in the howto collection from _creatorCountry to creatorCountry.
The change occurred on Sep 15, 2020 (after the upload of the gray flagged HowTo's) - in this commit

In order to solve this issue, we need to scan the howto collection and change the field _creatorCountry to creatorCountry.

@iSCJT
Copy link
Contributor

iSCJT commented Jan 2, 2024

I've checked the database and the _creatorCountry field isn't present for those howto's. Not sure whether the migration went wrong or the country wasn't set at the time the migration happened.

I'll look at writing a script to reset all the howto's to their creators current country. In the meantime if you want a quick fix @darigovresearch, I think changing your location to a different country, waiting a minute and then changing it back to your actual location should probably update them all.

@davehakkens
Copy link
Contributor

I think some locations might have been set using the map. If user has "want to get started" pin (we had a few bugs with that in the past)

@pizzaisdavid
Copy link
Collaborator

The link in the original post seems to not work exactly anymore, as filtering by author seems to have been be removed. But you can visit https://community.preciousplastic.com/u/darigov-research then the contributions tab, and then open all three howtos and see that there are still different flags.

I second what @iSCJT said. The user's location is stored both in the user profile data and the data of the howto (a design decision to optimize reads) and probably at one point the data didn't get synchronized, either because that functionality didn't exist yet or a bug.

@mariojsnunes
Copy link
Contributor

filtering by author seems to have been be removed.

Note this change: #3415 (same for howtos and questions)

@goratt12
Copy link
Collaborator

goratt12 commented Jul 7, 2024

I wrote a script that will finish the migration and solve this issue
https://github.com/goratt12/howtos-migration
Tested on the testing environment 👍

@pizzaisdavid
Copy link
Collaborator

@goratt12 Nice!

I didn't look at it in detail.

In my opinion, it would probably best to try to add it into the codebase, for example, copying an already existing one-time migration: https://github.com/ONEARMY/community-platform/blob/master/functions/src/database/updates.ts

I would propose introducing a folder in the database folder called migrations, and then calling your thingy something like 2024_07_07_whatever

But a disclaimer: so far, I didn't figure out how to trigger it.

@goratt12
Copy link
Collaborator

goratt12 commented Jul 7, 2024

@pizzaisdavid That is a good idea!
I will create a PR and insert this code as a function. we can run it using HTTP trigger

@L4ZZA
Copy link

L4ZZA commented Oct 10, 2024

Hi there, the flag also doesn't get updated upon changing country of residence :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New / Under Discussion
Development

No branches or pull requests

7 participants