< Summary

Class:DCL.Quests.QuestAnalyticsService
Assembly:Quests
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Quests/QuestAnalyticsService.cs
Covered lines:0
Uncovered lines:10
Coverable lines:10
Total lines:64
Line coverage:0% (0 of 10)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:8
Method coverage:0% (0 of 8)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
QuestAnalyticsService(...)0%2100%
SendQuestStarted(...)0%2100%
SendQuestCompleted(...)0%2100%
SendQuestCancelled(...)0%2100%
SendQuestProgressed(...)0%2100%
SendQuestJumpIn(...)0%2100%
SendQuestLogVisibilityChanged(...)0%2100%
SendPinnedQuest(...)0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Quests/QuestAnalyticsService.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using UnityEngine;
 5
 6namespace DCL.Quests
 7{
 8    public class QuestAnalyticsService : IQuestAnalyticsService
 9    {
 10        private const string STARTED_QUEST = "quest_started";
 11        private const string COMPLETED_QUEST = "quest_completed";
 12        private const string CANCELLED_QUEST = "quest_cancelled";
 13        private const string PROGRESSED_QUEST = "quest_progressed";
 14        private const string JUMPED_IN_QUEST = "quest_jumped_in";
 15        private const string QUEST_LOG_VISIBILITY_CHANGED = "quest_log_visibility_changed";
 16        private const string PINNED_QUEST = "quest_pinned";
 17
 18        private readonly IAnalytics analytics;
 19
 020        public QuestAnalyticsService(IAnalytics analytics)
 21        {
 022            this.analytics = analytics;
 023        }
 24
 25        public void SendQuestStarted(string questId) =>
 026            analytics.SendAnalytic(STARTED_QUEST, new Dictionary<string, string> { { "quest_id", questId } });
 27
 28        public void SendQuestCompleted(string questId) =>
 029            analytics.SendAnalytic(COMPLETED_QUEST, new Dictionary<string, string> { { "quest_id", questId } });
 30
 31        public void SendQuestCancelled(string questId) =>
 032            analytics.SendAnalytic(CANCELLED_QUEST, new Dictionary<string, string> { { "quest_id", questId } });
 33
 34        public void SendQuestProgressed(string questId, List<string> completedTasks, List<string> pendingTasks) =>
 035            analytics.SendAnalytic(PROGRESSED_QUEST,
 36                new Dictionary<string, string>
 37                {
 38                    { "quest_id", questId },
 39                    { "completed_tasks", string.Join(",", completedTasks) },
 40                    { "pending_tasks", string.Join(",", pendingTasks) }
 41                });
 42
 43        public void SendQuestJumpIn(string questId, string taskId, Vector2Int coordinates) =>
 044            analytics.SendAnalytic(JUMPED_IN_QUEST, new Dictionary<string, string>
 45            {
 46                { "quest_id", questId },
 47                { "task_id", taskId },
 48                { "coordinates", $"{coordinates.x},{coordinates.y}" }
 49            });
 50
 51        public void SendQuestLogVisibilityChanged(bool isVisible) =>
 052            analytics.SendAnalytic(QUEST_LOG_VISIBILITY_CHANGED, new Dictionary<string, string>
 53            {
 54                { "is_visible", isVisible.ToString() }
 55            });
 56
 57        public void SendPinnedQuest(string questId, bool isPinned) =>
 058            analytics.SendAnalytic(PINNED_QUEST, new Dictionary<string, string>
 59            {
 60                { "quest_id", questId },
 61                { "is_pinned", isPinned.ToString() }
 62            });
 63    }
 64}