nephila / python-taiga

:evergreen_tree: Python module for communicating with the Taiga API
https://python-taiga.readthedocs.io
MIT License
96 stars 41 forks source link

US status "out of bounds" #180

Open PluX59 opened 6 months ago

PluX59 commented 6 months ago

Description

In order to learn how to use python-taiga lib, I wrote a little program to get my projects US. I found that for my 2nd project, status of US (that are numeric/int) began at 16 (instead of 1 in 1st project). So I can't map US statuses in script (see commented line below).

Steps to reproduce

Using this code: The code:

from taiga import TaigaAPI

# Taiga constants
TAIGA_USERNAME = "my_mail_address@test.com"
TAIGA_PASSWORD = "my_taiga_password"
TAIGA_INSTANCE_URL = "http://localhost:9000"

def connect_taiga():
    api = TaigaAPI(
        host=TAIGA_INSTANCE_URL
    )
    api.auth(
        username=TAIGA_USERNAME,
        password=TAIGA_PASSWORD
    )
    return api

api = connect_taiga()
project_list = api.projects.list()

for project in project_list:
    print(f'name: {project.name} / description: {project.description}')
    us_list = project.list_user_stories()
    status_list = project.list_user_story_statuses()
    for status in status_list:
        print(f'status => {status.name}, color => {status.color}, order => {status.order}')
    for us in us_list:
        # status = status_list[us.status]
        print(f'subject: {us.subject} / status: {us.status}')

Produces this output:

C:\WINDOWS\system32>python C:\Apps\Tools\myBoard\myBoardTest.py
name: Projects / description: Personnal projects
status => New, color => #70728F, order => 0
status => Ready, color => #E44057, order => 1
status => In progress, color => #E47C40, order => 2
status => En attente / bloqué, color => #AC51D3, order => 3
status => Ready for test, color => #E4CE40, order => 4
status => Done, color => #A8E440, order => 5
status => Archived, color => #A9AABC, order => 6
subject: task 1 / status: 5
subject: task 2 / status: 2
subject: task 3 / status: 5
subject: task 4 / status: 1
name: Home / description: Home tasks
status => New, color => #70728F, order => 1
status => Ready, color => #E44057, order => 2
status => In progress, color => #E47C40, order => 3
status => Ready for test, color => #E4CE40, order => 4
status => Done, color => #A8E440, order => 5
status => Archived, color => #A9AABC, order => 6
subject: task 1 / status: 17
subject: task 2 / status: 16
subject: task 3 / status: 16
subject: task 4 / status: 16

Versions

"docker compose" version, images versions are:

file docker-compose.yml:

x-environment:
  &default-back-environment

  # Database settings
  POSTGRES_DB: taiga_db
  POSTGRES_USER: taiga_user
  POSTGRES_PASSWORD: taiga_pwd
  POSTGRES_HOST: taiga-db

  # Taiga settings
  TAIGA_SECRET_KEY: "a_secret_key_4_taiga"
  TAIGA_SITES_SCHEME: "http"
  TAIGA_SITES_DOMAIN: "localhost:9000"
  TAIGA_SUBPATH: "" # "" or "/subpath"
  RABBITMQ_USER: taiga
  RABBITMQ_PASS: taiga
  ENABLE_TELEMETRY: "True"

x-volumes:
  &default-back-volumes
  - /data/taiga/static:/taiga-back/static
  - /data/taiga/media:/taiga-back/media

services:
  taiga-db:
    image: postgres:12.3
    environment:
      POSTGRES_DB: taiga_db
      POSTGRES_USER: taiga_user
      POSTGRES_PASSWORD: taiga_pwd
    volumes:
      - /data/taiga/postgresql/taiga:/var/lib/postgresql/data
    networks:
      - taiga

  taiga-back:
    image: taigaio/taiga-back:6.5.1
    environment: *default-back-environment
    volumes: *default-back-volumes
    networks:
      - taiga
    depends_on:
      - taiga-db
      - taiga-events-rabbitmq
      - taiga-async-rabbitmq

  taiga-async:
    image: taigaio/taiga-back:6.5.1
    entrypoint: ["/taiga-back/docker/async_entrypoint.sh"]
    environment: *default-back-environment
    volumes: *default-back-volumes
    networks:
      - taiga
    depends_on:
      - taiga-db
      - taiga-back
      - taiga-async-rabbitmq

  taiga-async-rabbitmq:
    image: rabbitmq:3.8-management-alpine
    environment:
      RABBITMQ_ERLANG_COOKIE: secret-erlang-cookie
      RABBITMQ_DEFAULT_USER: taiga_mq_user
      RABBITMQ_DEFAULT_PASS: taiga_mq_pwd
      RABBITMQ_DEFAULT_VHOST: taiga_mq_host
    volumes:
      - /data/taiga/rabbitmq/async:/var/lib/rabbitmq
    networks:
      - taiga

  taiga-front:
    image: taigaio/taiga-front:6.4.2
    environment:
      TAIGA_URL: "http://localhost:9000"
      TAIGA_WEBSOCKETS_URL: "ws://localhost:9000"
      TAIGA_SUBPATH: "" # "" or "/subpath"
    networks:
      - taiga
    # volumes:
    #   - ./conf.json:/usr/share/nginx/html/conf.json

  taiga-events:
    image: taigaio/taiga-events:6.4.0
    environment:
      RABBITMQ_USER: taiga_mq_user
      RABBITMQ_PASS: taiga_mq_pwd
      TAIGA_SECRET_KEY: "a_secret_key_4_taiga"
    networks:
      - taiga
    depends_on:
      - taiga-events-rabbitmq

  taiga-events-rabbitmq:
    image: rabbitmq:3.8-management-alpine
    environment:
      RABBITMQ_ERLANG_COOKIE: secret-erlang-cookie
      RABBITMQ_DEFAULT_USER: taiga_mq_user
      RABBITMQ_DEFAULT_PASS: taiga_mq_pwd
      RABBITMQ_DEFAULT_VHOST: taiga_mq_host
    volumes:
      - /data/taiga/rabbitmq/events:/var/lib/rabbitmq
    networks:
      - taiga

  taiga-protected:
    image: taigaio/taiga-protected:6.4.0
    environment:
      MAX_AGE: 360
      SECRET_KEY: "a_secret_key_4_taiga"
    networks:
      - taiga

  taiga-gateway:
    image: nginx:1.19-alpine
    ports:
      - "9000:80"
    volumes:
      - /data/taiga/etc/gateway-nginx.conf:/etc/nginx/conf.d/default.conf
      - /data/taiga/static:/taiga/static
      - /data/taiga/media:/taiga/media
    networks:
      - taiga
    depends_on:
      - taiga-front
      - taiga-back
      - taiga-events

networks:
  taiga:

docker versions:

Expected behaviour

Result should be:

...
name: Home / description: Home tasks
...
subject: task 1 / status: 2
subject: task 2 / status: 1
subject: task 3 / status: 1
subject: task 4 / status: 1

Actual behaviour

...
name: Home / description: Home tasks
...
subject: task 1 / status: 17
subject: task 2 / status: 16
subject: task 3 / status: 16
subject: task 4 / status: 16

Additional information

It seems that when retrieving informations from project Home from UI (seen with development tools in chrome / F12), there is a "default_us_status": 16, field set in JSON response.

Maybe this value have to be substracted +1 to 'status' values ?