|
1256 | 1256 | const scoreColor = activityData.activityScore > 80 ? '#4caf50' : |
1257 | 1257 | activityData.activityScore > 60 ? '#ff9800' : '#ff4444'; |
1258 | 1258 |
|
| 1259 | + // Calculate engagement level |
| 1260 | + let engagementLevel = 'High'; |
| 1261 | + let engagementColor = '#4caf50'; |
| 1262 | + if (activityData.activityScore < 60) { |
| 1263 | + engagementLevel = 'Low'; |
| 1264 | + engagementColor = '#ff4444'; |
| 1265 | + } else if (activityData.activityScore < 80) { |
| 1266 | + engagementLevel = 'Medium'; |
| 1267 | + engagementColor = '#ff9800'; |
| 1268 | + } |
| 1269 | + |
1259 | 1270 | container.innerHTML = ` |
1260 | 1271 | <div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; border-radius: 8px; color: white; margin-bottom: 20px;"> |
1261 | 1272 | <div style="display: flex; justify-content: space-between; align-items: center;"> |
1262 | 1273 | <div> |
1263 | | - <h3 style="margin: 0; font-size: 24px;">Activity Score</h3> |
1264 | | - <div style="font-size: 48px; font-weight: bold; color: ${scoreColor}; text-shadow: 0 2px 4px rgba(0,0,0,0.2);"> |
1265 | | - ${activityData.activityScore || 0}% |
| 1274 | + <h3 style="margin: 0; font-size: 20px; opacity: 0.9;">Engagement Level</h3> |
| 1275 | + <div style="font-size: 36px; font-weight: bold; color: ${engagementColor}; text-shadow: 0 2px 4px rgba(0,0,0,0.2);"> |
| 1276 | + ${engagementLevel} |
| 1277 | + </div> |
| 1278 | + <div style="font-size: 14px; opacity: 0.7; margin-top: 5px;"> |
| 1279 | + Based on activity patterns |
1266 | 1280 | </div> |
1267 | 1281 | </div> |
1268 | 1282 | <div style="text-align: right;"> |
1269 | 1283 | <div style="font-size: 14px; opacity: 0.9;">Session Duration</div> |
1270 | 1284 | <div style="font-size: 20px; font-weight: bold;">${activityData.sessionDurationMinutes || 0} min</div> |
| 1285 | + <div style="font-size: 12px; opacity: 0.7; margin-top: 5px;"> |
| 1286 | + Score: ${activityData.activityScore || 0}/100 |
| 1287 | + </div> |
1271 | 1288 | </div> |
1272 | 1289 | </div> |
1273 | 1290 | </div> |
1274 | 1291 | |
| 1292 | + <h4 style="margin-bottom: 15px; color: #666;">📊 Behavior Metrics</h4> |
| 1293 | + |
1275 | 1294 | <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 20px;"> |
1276 | | - <div style="background: #f8f9fa; padding: 15px; border-radius: 8px; border-left: 4px solid #42a5f5;"> |
1277 | | - <div style="color: #666; font-size: 12px; text-transform: uppercase; margin-bottom: 5px;">Tab Switches</div> |
| 1295 | + <div style="background: #f8f9fa; padding: 15px; border-radius: 8px; border-left: 4px solid ${activityData.tabSwitches > 10 ? '#ff9800' : '#42a5f5'};"> |
| 1296 | + <div style="color: #666; font-size: 12px; margin-bottom: 5px;">🔄 TAB SWITCHES</div> |
1278 | 1297 | <div style="font-size: 24px; font-weight: bold; color: ${activityData.tabSwitches > 10 ? '#ff9800' : '#333'};"> |
1279 | 1298 | ${activityData.tabSwitches || 0} |
1280 | 1299 | </div> |
| 1300 | + <div style="font-size: 11px; color: #999; margin-top: 5px;"> |
| 1301 | + ${activityData.tabSwitches > 10 ? 'High (may indicate looking up answers)' : |
| 1302 | + activityData.tabSwitches > 5 ? 'Moderate' : 'Normal'} |
| 1303 | + </div> |
1281 | 1304 | </div> |
1282 | 1305 | |
1283 | | - <div style="background: #f8f9fa; padding: 15px; border-radius: 8px; border-left: 4px solid #66bb6a;"> |
1284 | | - <div style="color: #666; font-size: 12px; text-transform: uppercase; margin-bottom: 5px;">Idle Periods</div> |
| 1306 | + <div style="background: #f8f9fa; padding: 15px; border-radius: 8px; border-left: 4px solid ${activityData.idlePeriods > 5 ? '#ff9800' : '#66bb6a'};"> |
| 1307 | + <div style="color: #666; font-size: 12px; margin-bottom: 5px;">⏸️ IDLE PERIODS</div> |
1285 | 1308 | <div style="font-size: 24px; font-weight: bold; color: #333;"> |
1286 | 1309 | ${activityData.idlePeriods || 0} |
1287 | 1310 | </div> |
| 1311 | + <div style="font-size: 11px; color: #999; margin-top: 5px;"> |
| 1312 | + Times inactive for >1 minute |
| 1313 | + </div> |
1288 | 1314 | </div> |
1289 | 1315 | |
1290 | 1316 | <div style="background: #f8f9fa; padding: 15px; border-radius: 8px; border-left: 4px solid #ffa726;"> |
1291 | | - <div style="color: #666; font-size: 12px; text-transform: uppercase; margin-bottom: 5px;">Total Idle Time</div> |
| 1317 | + <div style="color: #666; font-size: 12px; margin-bottom: 5px;">⏱️ TOTAL IDLE TIME</div> |
1292 | 1318 | <div style="font-size: 24px; font-weight: bold; color: #333;"> |
1293 | | - ${activityData.totalIdleSeconds || 0}s |
| 1319 | + ${Math.round((activityData.totalIdleSeconds || 0) / 60)} min |
| 1320 | + </div> |
| 1321 | + <div style="font-size: 11px; color: #999; margin-top: 5px;"> |
| 1322 | + ${Math.round(((activityData.totalIdleSeconds || 0) / ((activityData.sessionDurationMinutes || 1) * 60)) * 100)}% of session |
1294 | 1323 | </div> |
1295 | 1324 | </div> |
1296 | 1325 | </div> |
1297 | 1326 | |
1298 | 1327 | ${activityData.suspiciousPatterns && activityData.suspiciousPatterns.length > 0 ? ` |
1299 | 1328 | <div style="background: rgba(255,152,0,0.1); border: 1px solid rgba(255,152,0,0.3); border-radius: 8px; padding: 15px; margin-top: 20px;"> |
1300 | | - <h4 style="color: #ff9800; margin-top: 0;">⚠️ Suspicious Patterns Detected</h4> |
| 1329 | + <h4 style="color: #ff9800; margin-top: 0;">⚠️ Notable Behaviors</h4> |
1301 | 1330 | <ul style="margin: 10px 0;"> |
1302 | | - ${activityData.suspiciousPatterns.map(p => ` |
1303 | | - <li style="color: #666; margin: 5px 0;"> |
1304 | | - ${p.type.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())} |
1305 | | - ${p.duration ? `(${Math.round(p.duration/1000)}s)` : ''} |
1306 | | - ${p.size ? `(${p.size} chars)` : ''} |
1307 | | - </li> |
1308 | | - `).join('')} |
| 1331 | + ${activityData.suspiciousPatterns.map(p => { |
| 1332 | + let description = ''; |
| 1333 | + if (p.type === 'quick_tab_switch') { |
| 1334 | + description = '• Quick tab switch (returned in < 5 seconds)'; |
| 1335 | + } else if (p.type === 'switch_and_paste') { |
| 1336 | + description = `• Pasted content after switching tabs ${p.size ? `(${p.size} characters)` : ''}`; |
| 1337 | + } else { |
| 1338 | + description = `• ${p.type.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}`; |
| 1339 | + } |
| 1340 | + return `<li style="color: #666; margin: 5px 0; list-style: none;">${description}</li>`; |
| 1341 | + }).join('')} |
1309 | 1342 | </ul> |
1310 | 1343 | </div> |
1311 | 1344 | ` : ''} |
1312 | 1345 | |
1313 | | - ${activityData.finalReport ? ` |
1314 | | - <div style="margin-top: 20px; padding: 10px; background: #e8f5e9; border-radius: 4px; text-align: center; color: #2e7d32;"> |
1315 | | - ✅ Final activity report saved at session end |
1316 | | - </div> |
1317 | | - ` : ''} |
| 1346 | + <div style="background: #e3f2fd; border-radius: 8px; padding: 15px; margin-top: 20px;"> |
| 1347 | + <h5 style="margin-top: 0; color: #1976d2;">ℹ️ Understanding the Metrics</h5> |
| 1348 | + <ul style="font-size: 12px; color: #666; margin: 10px 0; padding-left: 20px;"> |
| 1349 | + <li><strong>Engagement Level:</strong> Overall assessment based on activity patterns (High/Medium/Low)</li> |
| 1350 | + <li><strong>Tab Switches:</strong> Number of times candidate switched away from the interview tab</li> |
| 1351 | + <li><strong>Idle Periods:</strong> Number of times candidate was inactive for more than 1 minute</li> |
| 1352 | + <li><strong>Score:</strong> 0-100 score calculated from behavior patterns (100 = perfect engagement)</li> |
| 1353 | + </ul> |
| 1354 | + <small style="color: #999;">Note: These metrics are indicators only and should be considered alongside interview performance.</small> |
| 1355 | + </div> |
1318 | 1356 | `; |
1319 | 1357 | }) |
1320 | 1358 | .catch(error => { |
|
0 commit comments