mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
REturning new tickets as a TicketArray item
This commit is contained in:
parent
444e5815e9
commit
16313a73cb
@ -66,8 +66,9 @@ func listTickets(pag ...string) (*TicketArray, error) {
|
||||
|
||||
}
|
||||
|
||||
func newTickets(ticketStatus string) ([]Ticket, error) {
|
||||
func newTickets(ticketStatus string) ([]Ticket, *TicketArray, error) {
|
||||
newTickets := []Ticket{}
|
||||
newTicketArray := &TicketArray{}
|
||||
tickets, err := listTickets()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@ -75,8 +76,9 @@ func newTickets(ticketStatus string) ([]Ticket, error) {
|
||||
for _, Ticket := range tickets.Tickets {
|
||||
if Ticket.Status == ticketStatus && Ticket.Status != "closed" && Ticket.Status != "solved" {
|
||||
newTickets = append(newTickets, Ticket)
|
||||
newTicketArray.Tickets = append(newTicketArray.Tickets, Ticket)
|
||||
}
|
||||
}
|
||||
|
||||
return newTickets, nil
|
||||
return newTickets, newTicketArray, nil
|
||||
}
|
||||
|
@ -26,13 +26,14 @@ func NewWidget() *Widget {
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
func (widget *Widget) Refresh() {
|
||||
ticketStatus := wtf.Config.UString("wtf.mods.zendesk.status")
|
||||
tickets, err := newTickets(ticketStatus)
|
||||
tickets, ticketArray, err := newTickets(ticketStatus)
|
||||
ticketArray.Count = len(ticketArray.Tickets)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
widget.UpdateRefreshedAt()
|
||||
|
||||
widget.View.SetTitle(fmt.Sprintf("%s (%d)", widget.Name, len(tickets)))
|
||||
widget.View.SetTitle(fmt.Sprintf("%s (%d)", widget.Name, ticketArray.Count))
|
||||
widget.View.SetText(widget.textContent(tickets))
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user