You can think about this case in one of two ways.
One way is to believe that the plaintiff is being sleazy. Defendant makes a 998 offer shortly before the hearing on a summary judgment motion. At the hearing, the trial court orally grants the motion, and two minutes after the hearing ends, the plaintiff accepts the 998 offer and (a couple minutes after that) files the acceptance with the court. One way to look at this is to say that there's zero reason to enforce the offer in such settings, since the case is over anyway and letting people do this only discourages settlement since they can wait until after the MSJ hearing to decide whether to accept the offer or not.
The other way to look at this is to think that the defendant is being a moron, so gets what it deserves. The statute says that offers are good for 30 days or until the start of trial, unless they're revoked. Who makes a 998 offer right before an MSJ hearing and then doesn't revoke it on the eve of the hearing?! How stupid is that? If that's what the attorney (or client) wants to do, fine, but then they're stuck their incredibly unwise decision. They made an offer, it wasn't revoked, and it was accepted. End of story.