< Summary

Class:BiwSceneMetricsAnalyticsHelper
Assembly:BuilderInWorld
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/BiwSceneMetricsAnalyticsHelper.cs
Covered lines:7
Uncovered lines:12
Coverable lines:19
Total lines:49
Line coverage:36.8% (7 of 19)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
BiwSceneMetricsAnalyticsHelper(...)0%110100%
Dispose()0%110100%
OnMetricsUpdated(...)0%2100%
SendSceneLimitExceededAnalyticsEvent()0%12300%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/BuilderInWorld/Scripts/BiwSceneMetricsAnalyticsHelper.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using DCL;
 4using DCL.Controllers;
 5using DCL.Models;
 6using UnityEngine;
 7
 8public class BiwSceneMetricsAnalyticsHelper
 9{
 110    private string currentExceededLimitTypes = "";
 11
 12    private IParcelScene scene;
 13
 114    public BiwSceneMetricsAnalyticsHelper(IParcelScene sceneOwner)
 15    {
 116        this.scene = sceneOwner;
 117        scene.metricsCounter.OnMetricsUpdated += OnMetricsUpdated;
 118    }
 19
 20    public void Dispose()
 21    {
 122        scene.metricsCounter.OnMetricsUpdated -= OnMetricsUpdated;
 123    }
 24
 25    private void OnMetricsUpdated(ISceneMetricsCounter obj)
 26    {
 027        SendSceneLimitExceededAnalyticsEvent();
 028    }
 29
 30    private void SendSceneLimitExceededAnalyticsEvent()
 31    {
 032        if (scene.metricsCounter.IsInsideTheLimits())
 33        {
 034            currentExceededLimitTypes = "";
 035            return;
 36        }
 37
 038        var metricsModel = scene.metricsCounter.currentCount;
 039        var metricsLimits = scene.metricsCounter.maxCount;
 40
 041        string exceededLimits = BIWAnalytics.GetLimitsPassedArray(metricsModel, metricsLimits);
 42
 043        if (exceededLimits != currentExceededLimitTypes)
 44        {
 045            BIWAnalytics.SceneLimitsExceeded(metricsModel, metricsLimits);
 046            currentExceededLimitTypes = exceededLimits;
 47        }
 048    }
 49}