public void CompleteTracker()
    {
        // save progress
        CSUData originalData =
            TrackerManager.GetData(DateTime.Today, TrackerManager.TrackerType.CSU) as CSUData;

        originalData.ChangeBodyPart(_selectedBodyPart);

        originalData.SetAnswers(_csuData.GetAnswers());

        // save all photos
        List <int> texturesIndexes = _photosScrollController.GetSelectedPhotosIndexes();

        if (texturesIndexes != null && texturesIndexes.Count > 0)
        {
            List <string> paths = CameraManager.GetTexturesPaths(texturesIndexes, true);
            originalData.SavePhotos(paths);
        }

        TrackerManager.UpdateEntry(DateTime.Today, originalData);

        // open CSU tracker menu dialog asking for another body part data fillup
        ScreenManager.Instance.Set(24);

        Dispose();
    }
    private void OnBodyPartSelected(BodyPart bodyPart)
    {
        // if it's not a bodypart selection step, notify user that progress can be lost
        if (_currentStep != Step.BodyPartSelection)
        {
            // BUG - there is some kind of Unity bug which trigger Toggle onValueChange event execution while ToggleGroup allowToggleOff property turned off
            // skip if user clicked on a toggle which been already active
            if (_selectedBodyPart == bodyPart)
            {
                return;
            }

            // set toggle back to last selection
            _toggleGroup.SetAllTogglesOff();
            _bodyPartToggles.Single(x => x.bodyPart == _selectedBodyPart).SetValue(true);
            UIManager.NotificationManager.ShowNotification(
                "TwoOptionsTitleUINotification",
                -1,
                false,
                "Are you sure?",
                "Current progress will be lost if you change a body part",
                null,
                new string[] { "No", "Yes" },
                new string[] { "Stay", "Change" },
                new UnityAction[]
            {
                null,
                StartTracker
            }
                );
        }
        else
        {
            _selectedBodyPart = bodyPart;
            _csuData.ChangeBodyPart(_selectedBodyPart);
        }
    }
    /// <summary>
    /// Test method to generate random data for particular day.
    /// </summary>
    /// <param name="date"></param>
    /// <returns></returns>
    public static LogData GenerateRandomData(DateTime date)
    {
        // load random textures form resources
        Texture2D[] textures = Resources.LoadAll <Texture2D>("RandomTextures");
        date = date.Date;
        LogData logData = new LogData();

        // symptom tracker
        SymptomData symptomData = new SymptomData(date);

        for (int j = 0; j < symptomData.questionDataList.Count; j++)
        {
            QuestionBasedTrackerData.QuestionData qData = symptomData.GetQuestion();
            symptomData.SetAnswer(qData, UnityEngine.Random.Range(1, qData.answersOption.Length));
        }

        logData.symptomData = symptomData;

        // asthma test
        AsthmaData asthmaData = new AsthmaData(date);

        for (int j = 0; j < asthmaData.questionDataList.Count; j++)
        {
            QuestionBasedTrackerData.QuestionData qData = asthmaData.GetQuestion();
            asthmaData.SetAnswer(qData, UnityEngine.Random.Range(1, qData.answersOption.Length));
        }

        logData.asthmaData = asthmaData;

        // CSU test
        CSUData csuData = new CSUData(date);

        for (int j = 0; j < csuData.questionDataList.Count * 3; j++)
        {
            if (j == 0)
            {
                csuData.ChangeBodyPart(BodyPart.Head);
            }
            else if (j == 2)
            {
                csuData.ChangeBodyPart(BodyPart.Chest);
            }
            else if (j == 4)
            {
                csuData.ChangeBodyPart(BodyPart.Legs);
            }

            QuestionBasedTrackerData.QuestionData qData = csuData.GetQuestion();
            csuData.SetAnswer(qData, UnityEngine.Random.Range(1, qData.answersOption.Length));

            if (Random.value > 0.5f)
            {
                // add some random textures
                int count = Random.Range(0, textures.Length);

                // shuffle textures
                System.Random rnd      = new System.Random();
                Texture2D[]   shuffled = textures.OrderBy(x => rnd.Next()).ToArray();

                // and cut out the array
                Array.Resize(ref shuffled, count);

                csuData.SavePhotos(shuffled);
            }
        }

        logData.csuData = csuData;

        // UAS test
        UASData uasData = new UASData(date);

        for (int j = 0; j < uasData.questionDataList.Count; j++)
        {
            QuestionBasedTrackerData.QuestionData qData = uasData.GetQuestion();
            uasData.SetAnswer(qData, UnityEngine.Random.Range(1, qData.answersOption.Length));
        }

        logData.uasData = uasData;

        return(logData);
    }
    public static void FillTestData()
    {
        // Debug.Log("call");
        // load random textures form resources
        Texture2D[] textures = Resources.LoadAll <Texture2D>("RandomTextures");

        int days = Random.Range(65, 120);
        // int days = 1;
        // stay today date empty to use
        DateTime date = DateTime.Now.AddDays(-days).Date;

        Debug.Log("Fixed start date: " + date.ToString("dd/MM/yyyy"));

        JSONObject symptomJsonObject = new JSONObject();
        JSONObject asthmaJsonObject  = new JSONObject();
        JSONObject csuJsonObject     = new JSONObject();
        JSONObject uasJsonObject     = new JSONObject();

        for (int i = 0; i < days; i++)
        {
            if (i % 7 == 0)
            {
                // symptom tracker
                SymptomData symptomData = new SymptomData(date);
                for (int j = 0; j < symptomData.questionDataList.Count; j++)
                {
                    QuestionBasedTrackerData.QuestionData qData = symptomData.GetQuestion();
                    symptomData.SetAnswer(qData, Random.Range(1, qData.answersOption.Length));
                }

                symptomJsonObject.Add(symptomData.FormatToJson());
            }

            if (i % 14 == 0)
            {
                // asthma test
                AsthmaData asthmaData = new AsthmaData(date);
                for (int j = 0; j < asthmaData.questionDataList.Count; j++)
                {
                    QuestionBasedTrackerData.QuestionData qData = asthmaData.GetQuestion();
                    asthmaData.SetAnswer(qData, Random.Range(1, qData.answersOption.Length));
                }

                asthmaJsonObject.Add(asthmaData.FormatToJson());
            }

            if (Random.Range(0f, 1f) > 0.5f)
            {
                // CSU test
                CSUData csuData = new CSUData(date);
                for (int j = 0; j < csuData.questionDataList.Count * 3; j++)
                {
                    if (j == 0)
                    {
                        csuData.ChangeBodyPart(BodyPart.Head);
                    }
                    else if (j == 2)
                    {
                        csuData.ChangeBodyPart(BodyPart.Chest);
                    }
                    else if (j == 4)
                    {
                        csuData.ChangeBodyPart(BodyPart.Legs);
                    }

                    QuestionBasedTrackerData.QuestionData qData = csuData.GetQuestion();
                    csuData.SetAnswer(qData, Random.Range(1, qData.answersOption.Length));

                    if (Random.value > 0.5f)
                    {
                        // add some random textures
                        int count = Random.Range(0, textures.Length);

                        // shuffle textures
                        System.Random rnd      = new System.Random();
                        Texture2D[]   shuffled = textures.OrderBy(x => rnd.Next()).ToArray();

                        // and cut out the array
                        Array.Resize(ref shuffled, count);

                        csuData.SavePhotos(shuffled);
                    }
                }

                csuJsonObject.Add(csuData.FormatToJson());
            }

            if (Random.Range(0f, 1f) > 0.5f)
            {
                // UAS test
                UASData uasData = new UASData(date);
                for (int j = 0; j < uasData.questionDataList.Count; j++)
                {
                    QuestionBasedTrackerData.QuestionData qData = uasData.GetQuestion();
                    uasData.SetAnswer(qData, Random.Range(1, qData.answersOption.Length));
                }

                uasJsonObject.Add(uasData.FormatToJson());
            }

            // add a single day
            date = date.AddDays(1);
        }

        WriteToFile(Path.Combine(Helper.GetDataPath(), LOGS_FOLDER, CSU_LOG), csuJsonObject.Print(true));
        WriteToFile(Path.Combine(Helper.GetDataPath(), LOGS_FOLDER, UAS_LOG), uasJsonObject.Print(true));
        WriteToFile(Path.Combine(Helper.GetDataPath(), LOGS_FOLDER, SYMPTOM_LOG), symptomJsonObject.Print(true));
        WriteToFile(Path.Combine(Helper.GetDataPath(), LOGS_FOLDER, ASTHMA_TEST_LOG), asthmaJsonObject.Print(true));

        NotesManager.FillTestData(days);

        Debug.LogWarning($"Random log data generated for {days} days");
    }