Need help with a counting formula

I’m creating a learning tracker that offers training courses on 12 topics. For each topic, the student can either take one full segment course, or two half-segment courses to complete it. Courses are a data type in the db, so each topic has three courses in the table: 1) Full combined course, 2) Part A only, 3) Part B only. On a summary page, I want to display the number of topics completed for each student, but I need to take into account that people can choose to complete each topic using different combinations of courses. How can I tie all that up neatly into a single number?

You should have a completed_courses column in your User table, when User completed a course then update that column.