Class Rank + GPA that Colleges See. Senior Year Q's.

Ok. How important really is class rank? Do colleges look at the classes you take? It’s pretty unfair for one who takes all normal then one or two AP and get top 20, and one who takes all AP but gets B’s and doesn’t get top 20. How important truly is class rank? Furthermore, does senior year grades really matter? Do colleges only see your final junior year grades / GPA ? Or does the beginning senior year grades get sent too? Do senior year grades actually affect the GPA that colleges will see? For some schools, early decision is really early ; and I was wondering if senior year grades will affect the GPA that the ED schools see.