Get size number of jobs with given state and type.

Added a cardByType function which behaves like the card function but also specifies a job type.