Skip to content

Commit

Permalink
Add missing tags
Browse files Browse the repository at this point in the history
  • Loading branch information
spech66 committed Jan 3, 2024
1 parent 252f0d3 commit e95e4c7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions LifelogBb/Utilities/ControllerTagsExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using AutoMapper;
using LifelogBb.Models;
using LifelogBb.Models;
using Microsoft.AspNetCore.Mvc;

namespace LifelogBb.Utilities
Expand All @@ -13,8 +12,9 @@ public static void AddTagsToViewData(this Controller controller, LifelogBbContex
var tagsJournal = _context.Journals.Select(s => s.Tags).Distinct();
var tagsQuotes = _context.Quotes.Select(s => s.Tags).Distinct();
var tagsTodos = _context.Todos.Select(s => s.Tags).Distinct();
var tagsBucketLists = _context.BucketLists.Select(s => s.Tags).Distinct();

var tags = tagGoals.Union(tagsHabits).Union(tagsJournal).Union(tagsQuotes).Union(tagsTodos).Distinct();
var tags = tagGoals.Union(tagsHabits).Union(tagsJournal).Union(tagsQuotes).Union(tagsTodos).Union(tagsBucketLists).Distinct();
var tagsList = tags.ToList().Where(s => s != null).SelectMany(s => s.Split(',')).Distinct();

Check warning on line 18 in LifelogBb/Utilities/ControllerTagsExtensions.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.

Check warning on line 18 in LifelogBb/Utilities/ControllerTagsExtensions.cs

View workflow job for this annotation

GitHub Actions / Release (linux)

Dereference of a possibly null reference.
var tagsText = string.Join(",", tagsList);

Expand All @@ -28,8 +28,9 @@ public static void AddCategoriesToViewData(this Controller controller, LifelogBb
var tagsJournal = _context.Journals.Select(s => s.Category).Distinct();
var tagsQuotes = _context.Quotes.Select(s => s.Category).Distinct();
var tagsTodos = _context.Todos.Select(s => s.Category).Distinct();
var tagsBucketLists = _context.BucketLists.Select(s => s.Category).Distinct();

var categories = tagGoals.Union(tagsHabits).Union(tagsJournal).Union(tagsQuotes).Union(tagsTodos).Distinct();
var categories = tagGoals.Union(tagsHabits).Union(tagsJournal).Union(tagsQuotes).Union(tagsTodos).Union(tagsBucketLists).Distinct();
var categoriesList = categories.ToList().Where(s => s != null).Distinct();
var categoriessText = string.Join(",", categoriesList);

Expand Down

0 comments on commit e95e4c7

Please sign in to comment.