< Summary

Class:QuestTrackingInfo
Assembly:MainScripts
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/QuestTrackingInfo/QuestTrackingInfo.cs
Covered lines:17
Uncovered lines:4
Coverable lines:21
Total lines:46
Line coverage:80.9% (17 of 21)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
GetModel()0%2100%
UpdateFromModel(...)0%6.026092.31%
GetClassId()0%2100%
ApplyChanges()0%220100%
OnDestroy()0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/QuestTrackingInfo/QuestTrackingInfo.cs

#LineLine coverage
 1using System;
 2using DCL.Components;
 3using DCL.QuestsController;
 4using System.Collections;
 5using DCL.Models;
 6using UnityEngine;
 7
 8public class QuestTrackingInfo : BaseComponent
 9{
 010    private static IQuestsController questsController => QuestsController.i;
 11
 12    private QuestModel cachedModel;
 13
 814    private void Awake() { model = new QuestModel(); }
 15
 016    new public QuestModel GetModel() { return cachedModel; }
 17
 18    public override void UpdateFromModel(BaseModel newModel)
 19    {
 820        if (newModel == null)
 121            return;
 22
 723        base.UpdateFromModel(newModel);
 724        if (!(newModel is QuestModel quest))
 025            return;
 26
 727        bool isDifferentQuest = cachedModel != null && quest.id != cachedModel.id;
 728        cachedModel = (QuestModel) this.model;
 729        if (isDifferentQuest)
 430            questsController.RemoveQuest(cachedModel);
 31
 732        cachedModel = quest;
 733        if (cachedModel != null)
 734            questsController.UpdateQuestProgress(cachedModel);
 735    }
 36
 037    public override int GetClassId() { return (int) CLASS_ID_COMPONENT.QUEST_TRACKING_INFORMATION; }
 38
 639    public override IEnumerator ApplyChanges(BaseModel newJson) { yield break; }
 40
 41    private void OnDestroy()
 42    {
 443        if (cachedModel != null)
 344            questsController.RemoveQuest(cachedModel);
 445    }
 46}