diff --git a/backend/apps/github/models/mixins/release.py b/backend/apps/github/models/mixins/release.py index 750e1dddc2..f214dbd192 100644 --- a/backend/apps/github/models/mixins/release.py +++ b/backend/apps/github/models/mixins/release.py @@ -4,6 +4,8 @@ from django.utils.text import Truncator +DESCRIPTION_MAX_LENGTH = 1000 + class ReleaseIndexMixin: """Release index mixin.""" @@ -37,7 +39,7 @@ def idx_created_at(self) -> float: @property def idx_description(self) -> str: """Return description for indexing.""" - return Truncator(self.description).chars(1000, truncate="...") + return Truncator(self.description).chars(DESCRIPTION_MAX_LENGTH, truncate="...") @property def idx_is_pre_release(self) -> bool: diff --git a/backend/apps/owasp/models/mixins/project.py b/backend/apps/owasp/models/mixins/project.py index 515173359a..00589a1a03 100644 --- a/backend/apps/owasp/models/mixins/project.py +++ b/backend/apps/owasp/models/mixins/project.py @@ -11,6 +11,7 @@ ISSUES_LIMIT = 6 RELEASES_LIMIT = 4 REPOSITORIES_LIMIT = 4 +DEFAULT_HEALTH_SCORE = 100 class ProjectIndexMixin(RepositoryBasedEntityModelMixin): @@ -40,7 +41,7 @@ def idx_forks_count(self) -> int: def idx_health_score(self) -> float | None: """Return health score for indexing.""" # TODO(arkid15r): Enable real health score in production when ready. - return 100 if settings.IS_PRODUCTION_ENVIRONMENT else self.health_score + return DEFAULT_HEALTH_SCORE if settings.IS_PRODUCTION_ENVIRONMENT else self.health_score @property def idx_is_active(self) -> bool: