Recalculate parent sections when necessary#151
Conversation
|
Another issue was found with my code here: james-cnz/moodle-format_multitopic#50 . |
|
Hi @james-cnz ... Do you know how I can replicate the case in Onetopic so I can test the change? It's a very ambiguous change, and I wouldn't want to implement it if I can't test it before and after the code change. Saludos |
|
Hi @davidherney, I don't know if the first part affects Onetopic at the moment, so I'm not sure there's a way to test it. It caused an issue for my format when I added AJAX delete. The problem is, in AJAX actions, the modinfo can change, then the parent sections list needs to be changed too. To do this, when the parent sections are calculated, a link to the modinfo is saved. Then when the parent sections are fetched again, the saved modinfo link is compared to the current modinfo. If it's different, the parent sections list needs to be recalculated. The second part could be tested, but the only way I know is complicated. The problem is that, in obscure cases, the modinfo that should be checked isn't the modinfo for the current user, but for a different user. There's a note about it in course/format/classes/base.php function section_get_available_hook(): |
ced7a77 to
91f594c
Compare
I found problems with my course format when I added AJAX delete recently. I don't think it affects Onetopic currently, but maybe this change will avoid problems in the future.