@@ -79,6 +79,13 @@ private static LifeProfileSnapshot BuildSnapshot(UserProfileSnapshot behaviorSna
7979 tasks ??= new List < ItemGrid > ( ) ;
8080
8181 var activeTasks = tasks . Where ( t => t != null && t . IsActive ) . ToList ( ) ;
82+ var qualityTasks = activeTasks
83+ . Where ( t => TaskTextQualityHelper . IsMeaningfulTaskText ( t . Task ) )
84+ . ToList ( ) ;
85+ if ( ! qualityTasks . Any ( ) )
86+ {
87+ qualityTasks = activeTasks ;
88+ }
8289 int totalReminderResponses = Math . Max ( 1 ,
8390 behaviorSnapshot . ReminderCompletedCount +
8491 behaviorSnapshot . ReminderUpdatedCount +
@@ -98,29 +105,34 @@ private static LifeProfileSnapshot BuildSnapshot(UserProfileSnapshot behaviorSna
98105 . ToList ( ) ;
99106
100107 var topTopics = ( behaviorSnapshot . TaskKeywordHistogram ?? new Dictionary < string , int > ( ) )
108+ . Where ( kv => ! string . IsNullOrWhiteSpace ( kv . Key ) )
109+ . Where ( kv => ! string . Equals ( kv . Key , "High" , StringComparison . OrdinalIgnoreCase ) )
110+ . Where ( kv => ! string . Equals ( kv . Key , "Medium" , StringComparison . OrdinalIgnoreCase ) )
111+ . Where ( kv => ! string . Equals ( kv . Key , "Low" , StringComparison . OrdinalIgnoreCase ) )
112+ . Where ( kv => ! string . Equals ( kv . Key , "Unknown" , StringComparison . OrdinalIgnoreCase ) )
101113 . OrderByDescending ( kv => kv . Value )
102114 . ThenBy ( kv => kv . Key , StringComparer . OrdinalIgnoreCase )
103115 . Take ( 8 )
104116 . Select ( kv => kv . Key )
105117 . ToList ( ) ;
106118
107- int highHighCount = activeTasks . Count ( t =>
119+ int highHighCount = qualityTasks . Count ( t =>
108120 string . Equals ( t . Importance , "High" , StringComparison . OrdinalIgnoreCase ) &&
109121 string . Equals ( t . Urgency , "High" , StringComparison . OrdinalIgnoreCase ) ) ;
110122
111- int stuckTaskCount = activeTasks . Count ( t => t . LastProgressDate < now . AddDays ( - 3 ) ) ;
112- int goalLinkedCount = activeTasks . Count ( t => ! string . IsNullOrWhiteSpace ( t . LongTermGoalId ) ) ;
123+ int stuckTaskCount = qualityTasks . Count ( t => t . LastProgressDate < now . AddDays ( - 3 ) ) ;
124+ int goalLinkedCount = qualityTasks . Count ( t => ! string . IsNullOrWhiteSpace ( t . LongTermGoalId ) ) ;
113125
114126 var strengths = new List < string > ( ) ;
115127 if ( executionReliability >= 0.65 ) strengths . Add ( "consistent_executor" ) ;
116- if ( goalLinkedCount >= Math . Max ( 2 , activeTasks . Count / 3 ) ) strengths . Add ( "goal_oriented" ) ;
117- if ( highHighCount <= Math . Max ( 1 , activeTasks . Count / 4 ) ) strengths . Add ( "prioritization_control" ) ;
128+ if ( goalLinkedCount >= Math . Max ( 2 , qualityTasks . Count / 3 ) ) strengths . Add ( "goal_oriented" ) ;
129+ if ( highHighCount <= Math . Max ( 1 , qualityTasks . Count / 4 ) ) strengths . Add ( "prioritization_control" ) ;
118130 if ( peakHours . Any ( ) ) strengths . Add ( "predictable_energy_rhythm" ) ;
119131
120132 var risks = new List < string > ( ) ;
121133 if ( interruptionSensitivity >= 0.55 ) risks . Add ( "high_interruption_cost" ) ;
122- if ( stuckTaskCount >= Math . Max ( 2 , activeTasks . Count / 3 ) ) risks . Add ( "stuck_backlog" ) ;
123- if ( highHighCount >= Math . Max ( 3 , activeTasks . Count / 2 ) ) risks . Add ( "urgency_overload" ) ;
134+ if ( stuckTaskCount >= Math . Max ( 2 , qualityTasks . Count / 3 ) ) risks . Add ( "stuck_backlog" ) ;
135+ if ( highHighCount >= Math . Max ( 3 , qualityTasks . Count / 2 ) ) risks . Add ( "urgency_overload" ) ;
124136
125137 string style = "balanced" ;
126138 if ( executionReliability >= 0.7 && interruptionSensitivity <= 0.3 )
@@ -145,7 +157,7 @@ private static LifeProfileSnapshot BuildSnapshot(UserProfileSnapshot behaviorSna
145157 PeakHours = peakHours ,
146158 ExecutionReliability = executionReliability ,
147159 InterruptionSensitivity = interruptionSensitivity ,
148- ActiveTaskCount = activeTasks . Count ,
160+ ActiveTaskCount = qualityTasks . Count ,
149161 StuckTaskCount = stuckTaskCount ,
150162 GoalLinkedTaskCount = goalLinkedCount
151163 } ;
0 commit comments