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

Automatically move donation.purpose to donation.usage #66

Open
maurerle opened this issue Dec 3, 2022 · 5 comments
Open

Automatically move donation.purpose to donation.usage #66

maurerle opened this issue Dec 3, 2022 · 5 comments

Comments

@maurerle
Copy link
Member

maurerle commented Dec 3, 2022

If a community has donation.purpose set, it is marked as invalid (which was valid some time)

The generator should update that field to "usage" just as it updates the geodata field.

@CodPro-Sui
Copy link

Sample data structure representing a community

community = {
"donation": {
"purpose": "Old purpose"
}
}

Check if the community has "donation.purpose" set

if "donation" in community and "purpose" in community["donation"]:
# Move the value from "donation.purpose" to "donation.usage"
community["donation"]["usage"] = community["donation"]["purpose"]
del community["donation"]["purpose"]

Mark the community as valid

community["valid"] = True

Print the updated community data

print(community)

@maurerle
Copy link
Member Author

maurerle commented Oct 5, 2023

If this is a first draft of a PR to fix this, it might help to format this accordingly?
Where should this be added?

@CodPro-Sui
Copy link

To automatically move the value from "donation.purpose" to "donation.usage" as you've described in your code, you should add this code within a relevant section of your program where you want this transformation to occur. It depends on the context of your program and when you want this transformation to take place.

If you want this transformation to occur whenever you receive new data for the "donation" section, you might want to add it within the part of your code where you handle incoming data for the "donation" section.

Sample data structure representing a community

community = {
"donation": {
"purpose": "Old purpose"
}
}

Check if the community has "donation.purpose" set

if "donation" in community and "purpose" in community["donation"]:
# Move the value from "donation.purpose" to "donation.usage"
community["donation"]["usage"] = community["donation"]["purpose"]
del community["donation"]["purpose"]

Mark the community as valid

community["valid"] = True

Print the updated community data

print(community)

@maurerle
Copy link
Member Author

maurerle commented Oct 6, 2023

These autogenerated comments in a different coding language, completely unrelated to the existing project do not help.
Instead they create noise.
I reported this as spam, as it is quite likely that this account files a lot of auto generated comments that way.

@CodPro-Sui
Copy link

Have you idea about this then tell me more details

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

No branches or pull requests

2 participants