feat(ui): display the number of cards in a status.

Display the number of cards in a status column.

Resolves apollo/pelican#21
This commit is contained in:
Dan Anglin 2024-01-12 16:00:17 +00:00
parent 43b06a1fe3
commit 3703a7fd88
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
2 changed files with 10 additions and 7 deletions

View file

@ -74,19 +74,19 @@ and initialises the database with an empty project.
|Key |Key
|Action |Action
|CTRL + q |`CTRL + q`
|Quit the application |Quit the application
|c |`c`
|Create a new card |Create a new card
|CTRL + d |`CTRL + d`
|Delete a card |Delete a card
|m |`m`
|Move a card from one column to another (press `Enter` to confirm your selection). |Move a card from one column to another (press `Enter` to confirm your selection).
|Enter |`Enter`
|View the details of a card (press `ESC` to go back to the main board). |View the details of a card (press `ESC` to go back to the main board).
|=== |===

View file

@ -36,7 +36,6 @@ func newColumn(statusID int, statusName string, getBoardModeFunc func() boardMod
} }
column.SetBorder(true) column.SetBorder(true)
column.SetTitle(" " + statusName + " ")
return &column return &column
} }
@ -88,7 +87,9 @@ func (c *column) update(kanban board.Board) error {
return fmt.Errorf("unable to retrieve details about Status %d from the database; %w", c.statusID, err) return fmt.Errorf("unable to retrieve details about Status %d from the database; %w", c.statusID, err)
} }
if status.CardIds != nil && len(status.CardIds) > 0 { numCardIDs := len(status.CardIds)
if status.CardIds != nil && numCardIDs > 0 {
cards, err := kanban.CardList(status.CardIds) cards, err := kanban.CardList(status.CardIds)
if err != nil { if err != nil {
return fmt.Errorf("unable to get the list of cards from Status %d; %w", c.statusID, err) return fmt.Errorf("unable to get the list of cards from Status %d; %w", c.statusID, err)
@ -99,6 +100,8 @@ func (c *column) update(kanban board.Board) error {
} }
} }
c.SetTitle(fmt.Sprintf(" %s (%d) ", c.statusName, numCardIDs))
return nil return nil
} }