php-trello-api icon indicating copy to clipboard operation
php-trello-api copied to clipboard

Checlist item state always true

Open ilkka-rautiainen opened this issue 9 years ago • 8 comments

Because of this line:

https://github.com/cdaguerre/php-trello-api/blob/b1205d9ac9b24df03c2db5aa9a8c7418d28c0b78/lib/Trello/Model/Checklist.php#L245

$this->data['checkItems'][$key]['state'] = in_array($item['state'], array(true, 'complete', 'true'));

Should be:

$this->data['checkItems'][$key]['state'] = in_array($item['state'], array(true, 'complete', 'true'), true);

The problem is that both 'incomplete' == true and 'complete' == true evaluate to true. The strict mode is required (in_array, third parameter). To me it seems even unneeded to have this kind of in_array check. The values are just 'incomplete' and 'complete', right? Can't we trust on that?

ilkka-rautiainen avatar Jan 29 '16 14:01 ilkka-rautiainen

@ilkka-rautiainen I think so. Would you mind opening a PR?

cdaguerre avatar Jan 29 '16 17:01 cdaguerre

Probably not as I stopped using the library as it was slow.

pe 29. tammikuuta 2016 19.03 Christian Daguerre [email protected] kirjoitti:

@ilkka-rautiainen https://github.com/ilkka-rautiainen I think so. Would you mind opening a PR?

— Reply to this email directly or view it on GitHub https://github.com/cdaguerre/php-trello-api/issues/21#issuecomment-176862594 .

ilkka-rautiainen avatar Jan 29 '16 17:01 ilkka-rautiainen

Ok thanks for reporting anyway. This client uses guzzle for http requests and only adds a tiny bit of code so I'd be interested if you identified any specific bottlenecks...

cdaguerre avatar Jan 29 '16 17:01 cdaguerre

Actually I found that it could have been the trello itself that was slow..

pe 29. tammikuuta 2016 19.13 Christian Daguerre [email protected] kirjoitti:

Ok thanks for reporting anyway. This client uses guzzle for http requests and only adds a tiny bit of code so I'd be interested if you identified any specific bottlenecks...

— Reply to this email directly or view it on GitHub https://github.com/cdaguerre/php-trello-api/issues/21#issuecomment-176867724 .

ilkka-rautiainen avatar Jan 29 '16 17:01 ilkka-rautiainen

I think that it's very fast. Probably you have issues on your application reaching Trello's servers

ogabrielsantos avatar Jan 29 '16 17:01 ogabrielsantos

Or actually the working principle is heavy, for example to update one checklist item you have to first fetch the checklist itself.

pe 29. tammikuuta 2016 19.14 Ilkka Rautiainen [email protected] kirjoitti:

Actually I found that it could have been the trello itself that was slow..

pe 29. tammikuuta 2016 19.13 Christian Daguerre [email protected] kirjoitti:

Ok thanks for reporting anyway. This client uses guzzle for http requests and only adds a tiny bit of code so I'd be interested if you identified any specific bottlenecks...

— Reply to this email directly or view it on GitHub https://github.com/cdaguerre/php-trello-api/issues/21#issuecomment-176867724 .

ilkka-rautiainen avatar Jan 29 '16 17:01 ilkka-rautiainen

Maybe you could open a new issue so we can discuss this.

ogabrielsantos avatar Jan 29 '16 17:01 ogabrielsantos

I've submitted a PR to resolve this issue.

benrowe avatar Apr 02 '18 07:04 benrowe