Skip to content

Commit 83cc039

Browse files
Only display "Review needed" button if post is in review period
1 parent 6b9fd95 commit 83cc039

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: classes/review.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ public static function get_short_review_info_for_discussion(int $discussionid) {
8585
public static function get_first_review_post($moodleoverflowid, $afterpostid = null) {
8686
global $DB;
8787

88-
$params = ['moodleoverflowid' => $moodleoverflowid];
88+
$params = [
89+
'moodleoverflowid' => $moodleoverflowid,
90+
'reviewtime' => time() - get_config('moodleoverflow', 'reviewpossibleaftertime')
91+
];
8992
$orderby = '';
9093
$addwhere = '';
9194

@@ -105,7 +108,7 @@ public static function get_first_review_post($moodleoverflowid, $afterpostid = n
105108
$record = $DB->get_record_sql(
106109
'SELECT p.id as postid, p.discussion as discussionid FROM {moodleoverflow_posts} p ' .
107110
'JOIN {moodleoverflow_discussions} d ON d.id = p.discussion ' .
108-
"WHERE p.reviewed = 0 AND d.moodleoverflow = :moodleoverflowid $addwhere " .
111+
"WHERE p.reviewed = 0 AND d.moodleoverflow = :moodleoverflowid AND p.created < :reviewtime $addwhere " .
109112
"ORDER BY $orderby p.discussion, p.id " .
110113
'LIMIT 1',
111114
$params

0 commit comments

Comments
 (0)