Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
jefer94 committed Jul 18, 2024
1 parent 52ca15f commit 50e7167
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
6 changes: 2 additions & 4 deletions breathecode/assessment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,15 +441,13 @@ def get(self, request, assessment_slug, threshold_id=None):
lookup["academy__isnull"] = True

items = items.filter(**lookup)

if "tag" in self.request.GET:
param = self.request.GET.get("tag")
if param != "all":
items = items.filter(tags__icontains=param)
else:
items = items.filter(
Q(tags__isnull=True) | Q(tags="")
)
items = items.filter(Q(tags__isnull=True) | Q(tags=""))

items = items.order_by("-created_at")

Expand Down
2 changes: 1 addition & 1 deletion breathecode/marketing/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def validate_email(email, lang):
)
)

if ("is_mx_found" in data and data["is_mx_found"]["value"] == False):
if "is_mx_found" in data and data["is_mx_found"]["value"] == False:
raise ValidationException(
translation(
lang,
Expand Down
6 changes: 3 additions & 3 deletions breathecode/marketing/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ def get_custom_fields(self, obj):
processed_fields = {}
for key, value in obj.custom_fields.items():
if isinstance(value, list):
processed_fields[key] = ','.join(map(str, value))
processed_fields[key] = ",".join(map(str, value))
else:
processed_fields[key] = value
return processed_fields
return {}


class FormEntryHookSerializer(serpy.Serializer):
id = serpy.Field()
Expand Down Expand Up @@ -244,7 +244,7 @@ def get_custom_fields(self, obj):
processed_fields = {}
for key, value in obj.custom_fields.items():
if isinstance(value, list):
processed_fields[key] = ','.join(map(str, value))
processed_fields[key] = ",".join(map(str, value))
else:
processed_fields[key] = value
return processed_fields
Expand Down
14 changes: 8 additions & 6 deletions breathecode/provisioning/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,20 @@ def redirect_new_container_public(request):
return render_message(request, "Please specify a repository in the URL")

urls = {"gitpod": "https://gitpod.io/#", "codespaces": "https://github.com/codespaces/new/?repo="}
get_urls = { "codespaces": lambda x: x.replace("https://github.com/", "") }
get_urls = {"codespaces": lambda x: x.replace("https://github.com/", "")}
vendors = request.GET.get("vendor", "codespaces,gitpod").split(",")
buttons = []
for v in vendors:
if v not in urls:
return render_message(request, f"Invalid provisioning vendor: {v}")

buttons.append({
"label": f"Open in {v.capitalize()}",
"url": (get_urls[v](urls[v]) if v in get_urls else urls[v] + repo),
"icon": f"/static/img/{v}.svg"
})
buttons.append(
{
"label": f"Open in {v.capitalize()}",
"url": (get_urls[v](urls[v]) if v in get_urls else urls[v] + repo),
"icon": f"/static/img/{v}.svg",
}
)

data = {
# 'title': item.academy.name,
Expand Down
6 changes: 2 additions & 4 deletions breathecode/registry/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ def process_asset_config(asset, config):
if "videoSolutions" in config:
asset.with_solutions = True
asset.with_video = True

if "solution" in config:
asset.with_solutions = True
if isinstance(config["solution"], str):
Expand All @@ -790,7 +790,7 @@ def process_asset_config(asset, config):
if "en" in config["solution"]:
asset.solution_url = config["solution"]["en"]
elif asset.lang in config["solution"]:
asset.solution_url = config["solution"][asset.lang]
asset.solution_url = config["solution"][asset.lang]

if "grading" not in config and ("projectType" not in config or config["projectType"] != "tutorial"):
asset.interactive = False
Expand All @@ -815,8 +815,6 @@ def process_asset_config(asset, config):
continue
asset.technologies.add(technology)



if "delivery" in config:
if "instructions" in config["delivery"]:
if isinstance(config["delivery"]["instructions"], str):
Expand Down

0 comments on commit 50e7167

Please sign in to comment.