Skip to content

Commit 4146329

Browse files
committed
Clear user suggestion criteria cache for no projects
1 parent 82a2062 commit 4146329

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

pinc/UserSuggestions.inc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ class UserSuggestions
5353
}
5454
}
5555

56+
public function clear_cache(): void
57+
{
58+
// only clear the cache for the user looking at their own suggestions
59+
if ($this->_username == User::current_username()) {
60+
unset($_SESSION[$this->_cache_key]);
61+
}
62+
}
63+
5664
private function _calculate_normalized_weights(array $criteria): array
5765
{
5866
$new_criteria = [];

tools/proofers/my_suggestions.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@
7979
}
8080
if (count($projects) == 0) {
8181
echo "<p>" . $round_view_options[$round_view]["text_none"] . "</p>";
82+
83+
// clear the suggestions cache so if they get access to rounds and come
84+
// back to the page, we re-evaluate their suggestions
85+
$user_suggestions->clear_cache();
8286
} else {
8387
if ($explain_why) {
8488
// we don't html_safe() as they can contain HTML

0 commit comments

Comments
 (0)