zetkin / app.zetkin.org

Current-generation ("Gen 3") web interface for the Zetkin Platform.
https://app.dev.zetkin.org
23 stars 52 forks source link

Survey status is incorrect when ended #2078

Open Bagera opened 3 months ago

Bagera commented 3 months ago

Description

The status for an ended survey shows the wrong text on the survey page. The correct one is shown in the archive

Steps to reproduce

  1. Go to https://app.dev.zetkin.org/organize/1/projects/14/surveys/6
  2. Look at the header

Screenshots

Header with the incorrect chip image

Visibility status is shows as not scheduled image

henrycatalinismith commented 3 months ago

Surveys can be in any of the following states.

State Description
Draft No published date
Scheduled Published survey whose published date is in the future
Published Published survey whose published date is in the past and expiry date is in the future
Unpublished Published survey whose expiry date is in the past
Unknown Fallback state when the API call to find out the expiry & published dates returns nothing

So far this is kind of fine. Perhaps "expired" or some other word might be clearer than "unpublished", but the granularity is sufficient at least. Judging by the fact that you're reporting the text as a bug, I think it makes it pretty clear how easily misinterpreted the name is for this state. Probably worth considering changing it.

henrycatalinismith commented 3 months ago

The Not visible or scheduled message has a similar – but slightly different – problem. There are two different branches in the logic for this text which lead to this message. If we refer back to the states listed in my earlier post, this same text is used for both Draft and Unpublished surveys.

flowchart TD

    classDef className fill:#f9f,stroke:#333,stroke-width:4px;
    B:::className

    Z{Has start date and end date?} -->|yes| A
    A{End date in past?} -->|yes| B[Not visible or scheduled]
    A -->|no| C{Start date in future?}
    C -->|yes| D[🕑 Visible from :start to :end]
    C -->|no| E[👁️ Visible from :start to :end]
    Z -->|no| F{Has start date?}
    F -->|yes| G{Start date in future?}
    G -->|yes| H[👁️ Visible from :start onwards]
    G -->|no| I[🕑 Visible from :start onwards]
    F -->|no| B

This component is also used for call assignment schedules. My gut feeling here is that this probably has equal potential to confuse in that feature too. I think we should consider creating separate messages for these scenarios. Specifically, I think we should let Not visible or scheduled be the one for stuff that lacks start & dates, and introduce a new message for expired things, like Ended {time} ago or something like that.

flowchart TD

    classDef className fill:#f9f,stroke:#333,stroke-width:4px;
    classDef className2 fill:#9ff,stroke:#333,stroke-width:4px;
    B:::className2
    J:::className

    Z{Has start date and end date?} -->|yes| A
    A{End date in past?} -->|yes| B[Ended :relative_time ago]
    A -->|no| C{Start date in future?}
    C -->|yes| D[🕑 Visible from :start to :end]
    C -->|no| E[👁️ Visible from :start to :end]
    Z -->|no| F{Has start date?}
    F -->|yes| G{Start date in future?}
    G -->|yes| H[👁️ Visible from :start onwards]
    G -->|no| I[🕑 Visible from :start onwards]
    F -->|no| J[Not visible or scheduled]