Skip to content

Commit

Permalink
fix: Allow deleting subfields in review plan pico
Browse files Browse the repository at this point in the history
  • Loading branch information
bdewilde committed Mar 27, 2024
1 parent 66c17e3 commit e21c290
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions colandr/apis/resources/review_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,16 @@ def delete(self, id, fields):
for field in fields:
if field == "objective":
review_plan.objective = ""
elif field == "pico":
review_plan.pico = {}
elif field.startswith("pico"):
if field == "pico":
review_plan.pico = {}
else:
_, subfield = field.split(".")
review_plan.pico = {
key: val
for key, val in review_plan.pico.items()
if key != subfield
}
else:
setattr(review_plan, field, [])
else:
Expand Down

0 comments on commit e21c290

Please sign in to comment.