Skip to content

Commit

Permalink
fix: [AXM-1249] small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kyrylo-kh committed Dec 23, 2024
1 parent a6095d1 commit 1ef514f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions credentials/apps/badges/accredible/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def sync_groups(self, site_id: int) -> int:
"description": raw_group.get("course_description"),
"icon": self.fetch_design_image(raw_group.get("primary_design_id")),
"created": raw_group.get("created_at"),
"state": AccredibleGroup.STATES.active,
},
)

Expand Down
12 changes: 7 additions & 5 deletions credentials/apps/badges/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,11 @@ def groups(self):
Returns gorups and their statuses (fulfilled or not).
"""

return {
group: BadgeRequirement.is_group_fulfilled(group=group, template=self.template, username=self.username)
for group in self.template.groups
}
if self.template and self.template.origin == "accredible":
return {
group: BadgeRequirement.is_group_fulfilled(group=group, template=self.template, username=self.username)
for group in self.template.groups
}

@property
def completed(self):
Expand Down Expand Up @@ -683,7 +684,7 @@ class AccredibleAPIConfig(TimeStampedModel):
Accredible API configuration.
"""

name = models.CharField(max_length=255, help_text=_("Accredible API configuration name."), null=True, blank=True)
name = models.CharField(max_length=255, help_text=_("Accredible API configuration name."), null=True, blank=False)
api_key = models.CharField(max_length=255, help_text=_("Accredible API key."))

@classmethod
Expand All @@ -693,6 +694,7 @@ def get_all_api_config_ids(cls):
"""
return list(cls.objects.values_list("id", flat=True))


class AccredibleGroup(BadgeTemplate):
"""
Accredible badge group credential type.
Expand Down

0 comments on commit 1ef514f

Please sign in to comment.