Engagement Boost misreads smart-link views that have a thousands separator

Abierto Apto para principiantes
#4,856 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
82/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php, typescript, wordpress

Línea de trabajo

Empieza en src/content-helper/dashboard-page/components/posts-table/components/single-post-row.tsx:106 y compara cómo se analizan las visualizaciones de smart links con las visualizaciones totales. Comprueba el recuento formateado que devuelve src/rest-api/stats/trait-post-data.php:129 y ten en cuenta los separadores de cada configuración regional. La tarea estará terminada cuando la fila muestre correctamente las visualizaciones de smart links y el porcentaje de contenido impulsado para recuentos grandes en todas las configuraciones regionales.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug Feature: Engagement Boost wp-parsely

Describe the bug

The Engagement Boost dashboard reads a post's smart-link views with Number( stats?.campaign?.views ?? 0 ) (src/content-helper/dashboard-page/components/posts-table/components/single-post-row.tsx:106). The REST API formats that value with number_format_i18n() (src/rest-api/stats/trait-post-data.php:129), so from 1,000 views on it contains the locale's thousands separator, which Number() doesn't parse:

  • "1,234" becomes NaN, as does a value with a space-like separator, as in French. The "+N" smart-link views and the "X% BOOSTED" percentage then both disappear, since their > 0 checks fail.
  • With . as the separator, as in German, "1.234" becomes 1.234. The dashboard then shows a wrong "+N" and a near-zero boost percentage.

Total views, on the line above, are parsed with .replace( /\D/g, '' ), which handles any separator.

To Reproduce

  1. Open the Engagement Boost dashboard for a post with 1,000 or more smart-link views in the selected period.
  2. The post's row shows its total views, without the "+N" smart-link views or the "BOOSTED" percentage.

Expected behavior

The dashboard shows the post's smart-link views and boost percentage, whatever their size and the site's locale.

Environment

wp-parsely 3.26.1 and current develop, any browser.

Additional context

Possible fixes: parse the value the same way as the total views, or have the REST API also return raw counts, so the client doesn't parse formatted strings.

Related: #4854 and #4855, which affect the same campaign data.

Lenguaje dominante
PHP
Estrellas
67
Forks
38
Merge medio
1 d 5 h
PR fusionados (30 d)
79

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Parsely/wp-parsely

Todos los issues de Parsely/wp-parsely

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.