fix(): project refactoring and minor fixes
This commit is contained in:
@@ -12,7 +12,12 @@ from apps.conflicts.models import ExperimentConflictDomain
|
||||
from apps.conflicts.services import resolve_domain_conflict
|
||||
from apps.events.models import Decision
|
||||
from apps.events.services import decision_create
|
||||
from apps.experiments.models import Experiment, ExperimentStatus, Variant
|
||||
from apps.experiments.models import (
|
||||
ACTIVE_STATUSES,
|
||||
Experiment,
|
||||
ExperimentStatus,
|
||||
Variant,
|
||||
)
|
||||
from apps.experiments.selectors import active_experiment_for_flag
|
||||
from apps.flags.models import FeatureFlag
|
||||
from apps.flags.selectors import feature_flag_get_by_key
|
||||
@@ -33,7 +38,7 @@ MAX_CONCURRENT_EXPERIMENTS = 3
|
||||
COOLDOWN_DAYS = 7
|
||||
|
||||
|
||||
def _hash_subject(subject_id: str, experiment_id: str, salt: str) -> float:
|
||||
def _hash_subject(subject_id: str, experiment_id: str, salt: str) -> Decimal:
|
||||
hash_input = f"{subject_id}:{experiment_id}:{salt}".encode()
|
||||
hash_bytes = hashlib.sha256(hash_input).digest()
|
||||
hash_int = int.from_bytes(hash_bytes[:8], byteorder="big")
|
||||
@@ -112,6 +117,9 @@ def _check_participation_limits(
|
||||
subject_id=subject_id,
|
||||
reason="experiment_assigned",
|
||||
experiment_id__isnull=False,
|
||||
experiment_id__in=Experiment.objects.filter(
|
||||
status__in=ACTIVE_STATUSES,
|
||||
).values("pk"),
|
||||
)
|
||||
.exclude(experiment_id=experiment_pk)
|
||||
.values("experiment_id")
|
||||
|
||||
Reference in New Issue
Block a user