qiwi / tech-radar

Fully automated tech-radar generator
https://qiwi.github.io/tech-radar/
MIT License
26 stars 13 forks source link

Input of CSV option with "moved" property not working #95

Closed sanjaybhatol closed 1 year ago

sanjaybhatol commented 1 year ago

Issue type

Expected behaviour

When a csv input with "moved" property passed as 1 or -1, it should show the "moving up" and "moving down" triangles accordingly.

Actual behaviour

Regardless of passing "moved" value in CSV as 1 or -1, the radar always shows a "round" blip. It never renders "moving up" or "down" triangle.

As per docs, if following is passed, we expect and "moving up" triangle to be rendered on radar - please note passing 1 as "moving" field. e.g. name, quadrant, ring, description, moved cypress, lang, Adopt, Фреймворк для e2e тестов, 1

Also, I was bit surprised to see in your tech radar, https://github.com/qiwi/tech-radar/blob/master/data/js/2022-07.csv even though there is no "moved" column mentioned in csv, the actual tech radar https://qiwi.github.io/tech-radar/js/2022-07-25/ displays "moving up" and "moving down" triangles.

Could you please help fix it or help me understand if I am making any mistake?

antongolub commented 1 year ago

Hey, @sanjaybhatol,

Well, seems like a bug. We use the calculated moved value even though it was passed via the entry prop. The arrows keep working only because we have the prev radar snapshot to resolve the delta.

  radars.forEach(({ document: { data }, scope }, i) => {
    data.forEach((entry) => {
      const { name, ring } = entry
      const lowerName = name.toLowerCase()
      const prevRadar = radars[i + 1] // NOTE sorted by desc date
      const prevEntry =
        prevRadar &&
        prevRadar.scope === scope &&
        prevRadar.document.data.find(
          ({ name: _name }) => _name.toLowerCase() === lowerName,
        )
      const moved = prevEntry
        ? Math.sign(getRingWeight(ring) - getRingWeight(prevEntry.ring))
        : 0

Thanks for the report.

antongolub commented 1 year ago

https://github.com/qiwi/tech-radar/releases/tag/v1.13.11