@Carmen25
As you realized, using the total grade in the class is problematic.
The total column won't be 100% unless every graded assignment is also 100% (ignoring the possibility of bonus points). There is no sense of a passing grade (which might be 70%) getting turned into 100% for the total.
The only way to get 100% for the total is every graded assignment is 100% (or you have bonus points). That means that you will never be able to rely on just the total for the course as a way of checking completion. The total will be 100% whether they have one, two, or twenty assignments completed at the 100% level. It will only be less than 100% if some assignment has less than 100%, but that will have to be corrected before the total is 100%. That means that looking at the total is not going to meet your needs.
Since what you are asking for won't solve your problem and would be problematic for everyone else, the idea to only show the total when assignment has been graded is the wrong approach.
Knowing a little more about how the class is set up could help us provide the best answer. I'll give some different solutions, hopefully one of them will work or at least inspire you towards a working solution.
If you have a final assessment or require that the assignments be done in order so there is a sense that one assignment marks completion of the course, then you could get the submissions for the final assignment and see when it is at least 100%. This is what we do in our student orientation class. There is a final quiz that students must pass with at least 80%. I fetch the submissions for that assignment to decide when students are done with the course. If this is happening for multiple courses, then you would need to include logic to know which assignment to check. It might be as simple as naming the assignment or it maybe looking at due dates to see which one is due last. If you have a limited number of courses, you might be able to hard-code the IDs of the assignments to check.
If you don't have one assignment that marks successful completion, then you could fetch all submissions for all assignments for all students. This can be done with a single API call, although pagination will likely need to be used. You will then need to process the assignments to see that all of them have been completed satisfactory. This allows for something less than 100%, but requires that you define what a passing grade is for each assignment. I fetch the entire gradebook (all submissions) for some of my scripts and it's not too bad. However, this may be problematic to extend to multiple courses with varying setups and different requirements for what a passing grade is.
If you use modules and requirements to define what a passing grade is, then you could check the module progression to see when the module requirements have been satisfied. If you have multiple modules that can be completed in any order, then you could check the progress on each module. If there is a particular order to the modules, then you would only need to check the completion on the last module. Unfortunately, this endpoint is per-student, so you would have to make a call for each student. Not terrible if this is one course or enrollment is limited, but it's not really scalable if this is for a lot of courses with a lot of students.