public async Task <IEnumerable <Motivation> > GetMotivationsForType(MotivationType motivationType) { var motivationsByType = await _motivationEntityStore.GetByPartitionAsync(motivationType.ToString()); return(motivationsByType.Select(x => new Motivation { Id = new Guid(x.RowKey), MotivationType = (MotivationType)Enum.Parse(typeof(MotivationType), x.PartitionKey, true), MotivationMessage = x.MotivationMessage })); }
public Task InsertMotivation(string userId, MotivationType motivationType, string message) { var newMotivationId = Guid.NewGuid().ToString(); var motivationEntity = new MotivationEntity(motivationType.ToString(), newMotivationId, message, userId); var motivationEntityTask = _motivationEntityStore.SetAsync(motivationEntity); var motivationByIdEntity = new MotivationByIdEntity(userId, newMotivationId, message, motivationType); var motivationByIdEntityTask = _motivationByIdEntityStore.SetAsync(motivationByIdEntity); return(Task.WhenAll(new Task[] { motivationEntityTask, motivationByIdEntityTask })); }
public void Initialize(string _minigameID, UnityEvent _minigameCompleted, TextMeshProUGUI _progressText = null) { hasWon = false; curProgress = 0; minigameCompleted?.RemoveAllListeners(); minigameID = _minigameID; ScoreData scoreData = Instance.data.GetData(_minigameID); goal = scoreData.Goal; phrase = scoreData.Phrase; progressText = _progressText; motivationType = scoreData.MotivationType; minigameCompleted = _minigameCompleted; }
public void UpdateMotivation(MotivationType type) { int delta = incrementation; if (type == MotivationType.Reduce) { delta *= -1; } currMotivation += delta; currMotivation = Mathf.Clamp(currMotivation , 0 , maxMotivation); OnMotivationUpdated?.Invoke(FillRatio); SaveData(); }
private void Update() { if (Input.GetKeyDown(increaseKey)) { type = MotivationType.Gain; IncrementMotivation(); } else if (Input.GetKeyDown(decreaseKey)) { type = MotivationType.Reduce; IncrementMotivation(); } if (Input.GetKeyDown(ResetKey)) { ResetMotivation(); } }
public async Task <bool> InsertPushSchedule(string userId, MotivationType motivationType, DateTime timeofDay) { var pushScheduleEntity = new ScheduledPushEntity(timeofDay.Hour.ToString(), userId, motivationType); return(await _pushEntityStore.SetAsync(pushScheduleEntity)); }
private async Task SendToQueue(ILogger logger, Guid userId, MotivationType motivationType) { await _pushJobQueueManager.PushMessage(new MotivationQueueMessage { UserId = userId, MotivationType = motivationType }); logger.LogInformation($"Sending motivation to {userId} with a {motivationType} of encouragement!"); }
public ScheduledPushEntity(string partitionKey, string rowKey, MotivationType motivationType) { PartitionKey = partitionKey; RowKey = rowKey; MotivationType = motivationType.ToString(); }
public Task <IEnumerable <Motivation> > GetAllForType(MotivationType motivationType) { return(_motivationsStoreManager.GetMotivationsForType(motivationType)); }
public MotivationByIdEntity(string userId, string motivationId, string motivationMessage, MotivationType motivationType) { PartitionKey = userId; RowKey = motivationId; MotivationMessage = motivationMessage; UserId = userId; MotivationType = motivationType.ToString(); }