The given ration (7:15) means that there are 7 students who prefer doing homework before school and 15 students who prefer doing homework after school.
If you add 7+15= 22 you get the total number of students in the class.
Therefore, the ratio 7/22 will represent what part of the class prefers doing homework before school. You can express it as a percentage, as well:
7/22 = 0.32 which means 32%.