def completion_single_env(self, env_id):
        """Return fraction of cases that have a completed result for an env."""
        total = RunCaseVersion.objects.filter(
            environments=env_id,
            run=self).count()
        skipped = Result.objects.filter(
            runcaseversion__run=self,
            environment=env_id,
            is_latest=True,
            status=Result.STATUS.skipped).count()
        completed = Result.objects.filter(
            status__in=Result.COMPLETED_STATES,
            is_latest=True,
            environment=env_id,
            runcaseversion__run=self).values(
            "runcaseversion", "environment").distinct().count()

        try:
            return (total - skipped) / float(completed)
        except ZeroDivisionError:
            return 0.0
dataset/ETHPy150Open mozilla/moztrap/moztrap/model/execution/models.py/Run.completion_single_env/swapped operands of `/`