WordPress / five-for-the-future

Plugins and themes for the Five for the Future subsite
https://wordpress.org/five-for-the-future/
46 stars 21 forks source link

Duplicate contributor posts are created #55

Closed iandunn closed 4 years ago

iandunn commented 4 years ago

When a pledge is submitted, contributor posts are created for the listed contributors, but there isn't a check if they've already been submitted by other organizations, so duplicate posts are created.

ryelle commented 4 years ago

Is this a problem? We talked about this on the doc – since each contributor can only have one parent pledge, the post is more "per user per pledge", not per wp.org user.

The idea is that each contributor that is linked to a pledge is a distinct entity with its own meta data (e.g. whether or not they've confirmed, and maybe some things pulled from Profiles like how many hours they are sponsored for, which teams, etc.) The most efficient way to manage these entities and their data within our existing data architecture seems to be a post type. This wouldn't be used for individual contributors' pledges, only contributors that are linked to an organization's pledge.

iandunn commented 4 years ago

🤔 , you're right.

In hindsight that seems counter-intuitive, and it's also re-creating what is essentially a person/user account. I wonder if multiple wp_usermeta.5ftf_pledge items would fit better, which each of them being array( 'pledge_id', => n, 'status' => 'pending', etc ).

Probably not worth doing anything at this point, though.

iandunn commented 4 years ago

🤔 , although, we wouldn't be able to query for all of the contributors to a pledge directly if w/ the usermeta above. We could store user_ids in post_meta for the pledge post type, but that would be kind of redundant. Although maybe we already have that redundancy in the existing approach as well, so 🤷‍♂