Exemple #1
0
        public static TextFieldInfo FromTimeEntrySuggestion(
            this TextFieldInfo textFieldInfo,
            TimeEntrySuggestion timeEntrySuggestion)
        {
            var builder = ImmutableList.CreateBuilder <ISpan>();

            builder.Add(new TextSpan(timeEntrySuggestion.Description));

            if (timeEntrySuggestion.HasProject)
            {
                var projectSpan = new ProjectSpan(
                    timeEntrySuggestion.ProjectId.Value,
                    timeEntrySuggestion.ProjectName,
                    timeEntrySuggestion.ProjectColor,
                    timeEntrySuggestion.TaskId,
                    timeEntrySuggestion.TaskName
                    );

                builder.Add(projectSpan);
            }

            builder.Add(new QueryTextSpan());

            return(TextFieldInfo
                   .Empty(timeEntrySuggestion.WorkspaceId)
                   .ReplaceSpans(builder.ToImmutable()));
        }
 private bool timeEntrySuggestionHasPartialContent(TimeEntrySuggestion timeEntrySuggestion)
 => string.IsNullOrEmpty(timeEntrySuggestion.Description) || !timeEntrySuggestion.HasProject;