This is from the CCC:
1023 Those who die in God’s grace and friendship and are perfectly purified live for ever with Christ. They are like God for ever, for they “see him as he is,” face to face:598
By virtue of our apostolic authority, we define the following: According to the general disposition of God, the souls of all the saints . . . and other faithful who died after receiving Christ's holy Baptism (provided they were not in need of purification when they died, . . . or, if they then did need or will need some purification, when they have been purified after death, . . .) already before they take up their bodies again and before the general judgment - and this since the Ascension of our Lord and Savior Jesus Christ into heaven - have been, are and will be in heaven, in the heavenly Kingdom and celestial paradise with Christ, joined to the company of the holy angels. Since the Passion and death of our Lord Jesus Christ, these souls have seen and do see the divine essence with an intuitive vision, and even face to face, without the mediation of any creature.599
1026 By his death and Resurrection, Jesus Christ has “opened” heaven to us. The life of the blessed consists in the full and perfect possession of the fruits of the redemption accomplished by Christ. He makes partners in his heavenly glorification those who have believed in him and remained faithful to his will. Heaven is the blessed community of all who are perfectly incorporated into Christ.
1030 All who die in God’s grace and friendship, but still imperfectly purified, are indeed assured of their eternal salvation; but after death they undergo purification, so as to achieve the holiness necessary to enter the joy of heaven.
1031 The Church gives the name Purgatory to this final purification of the elect, which is entirely different from the punishment of the damned.606 The Church formulated her doctrine of faith on Purgatory especially at the Councils of Florence and Trent. The tradition of the Church, by reference to certain texts of Scripture, speaks of a cleansing fire:607
it would then seem to me that even if a person dies in a state of grace, and if the soul needs purification before entering heaven, then the soul goes to purgatory until such time it can enter heaven. correct? it is still up to God to decide if the soul needs purifcation even if it is in a state of grace correct?