Skip to content

Commit

Permalink
allow only importing national data if a column doesn't matches a value
Browse files Browse the repository at this point in the history
Some sheets have data for, e.g. multiple years in and we only want one
of them so update the skip logic to allow for skipping unless the column
matches versus skipping if the column does not match
  • Loading branch information
struan committed Dec 11, 2024
1 parent 5e93754 commit 13c1609
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crowdsourcer/management/commands/import_national_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,15 @@ def import_answers(self, user, rt, df, q, details):
for _, row in df.iterrows():
if details.get("skip_check", None) is not None:
skip_check = details["skip_check"]
if row[skip_check["col"]] == skip_check["val"]:
if (
skip_check.get("unless_match")
and row[skip_check["col"]] != skip_check["val"]
):
continue
elif (
not skip_check.get("unless_match")
and row[skip_check["col"]] == skip_check["val"]
):
continue

gss_col = details.get("gss_col", "Local Authority Code")
Expand Down

0 comments on commit 13c1609

Please sign in to comment.