I experienced this in my previous job. Although I strived to do well, signing up for courses myself, completing them and getting a certificate so I could do my job better, my face just did not fit. People who pretended to look busy(doing nothing actually), were the people who were praised.
I will never understand it, but it goes on all the time and I've witnessed this many times.
At one particular time, I was made to feel I was in a corner on my own. The boss would give me no eye contact, tried to make me do menial jobs and give the best to another colleague, who did not have a clue what to do, but they were smoking buddies and I do not smoke. I felt I was being talked about all the time. They spent most of their day outside smoking, why I ran the office, it was appalling. It is something I try not to think about but sometimes it slips back to mind.
I always think that what comes around goes around, and actually it did. But at the time, I hated my job and dreaded the thought of even going to work.