From 13a2f9a76ae1c70ce1dce1575753b939c50c38fd Mon Sep 17 00:00:00 2001 From: Patrick Huck Date: Mon, 8 Apr 2024 14:58:16 -0700 Subject: [PATCH] client: convert bools and skip non-str --- mpcontribs-client/mpcontribs/client/__init__.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mpcontribs-client/mpcontribs/client/__init__.py b/mpcontribs-client/mpcontribs/client/__init__.py index dc414f295..da829ee9d 100644 --- a/mpcontribs-client/mpcontribs/client/__init__.py +++ b/mpcontribs-client/mpcontribs/client/__init__.py @@ -2163,9 +2163,19 @@ def submit_contributions( ): continue - contribs[project_name].append( - {k: deepcopy(contrib[k]) for k in fields if k in contrib} - ) + contrib_copy = {} + for k in fields: + if k in contrib: + flat = {} + for kk, vv in flatten(contrib[k], reducer="dot").items(): + if isinstance(vv, bool): + flat[kk] = "Yes" if vv else "No" + elif isinstance(vv, str): + flat[kk] = vv + + contrib_copy[k] = deepcopy(unflatten(flat, splitter="dot")) + + contribs[project_name].append(contrib_copy) for component in COMPONENTS: elements = contrib.get(component, [])