Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foreach (var goal in goals)
- {
- var text = string.Format(AppResources.GoalsReminderNotification, goal.Name);
- var count = await GoalComment.GetFromParent(goal.Id).CountAsync();
- int days;
- if (goal.Period.Equals(Goal.MonthPeriod))
- days = 5;
- else if (goal.Period.Equals(Goal.YearPeriod))
- days = 14;
- else
- days = 60;
- if (count == 0) //if user hasn't left a comment to the goal
- {
- if (DateTime.Today >= goal.CreatedAt.Value.AddDays(days) + goal.Period)
- {
- ShowGoalReminderNotification(id, text, goal.Id);
- }
- continue;
- }
- var comments = await GoalComment.GetFromParent(goal.Id).ToListAsync();
- var lastComment = comments[comments.Count - 1];
- if (DateTime.Today >= lastComment.CreatedAt.Value.AddDays(days))
- {
- ShowGoalReminderNotification(id, text, goal.Id);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement