Skip to content

Commit a161e7a

Browse files
committed
rename statusteacher and statusstarter in markedhelpful and markedsolution
1 parent 82e7ff7 commit a161e7a

File tree

8 files changed

+48
-48
lines changed

8 files changed

+48
-48
lines changed

amd/build/rating.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/rating.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/src/rating.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export function init(userid, allowmultiplemarks) {
106106
case 'helpful':
107107
case 'solved': {
108108
const isHelpful = action === 'helpful';
109-
const htmlclass = isHelpful ? 'statusstarter' : 'statusteacher';
109+
const htmlclass = isHelpful ? 'markedhelpful' : 'markedsolution';
110110
const shouldRemove = postElement.classList.contains(htmlclass);
111111
const baseRating = isHelpful ? RATING_HELPFUL : RATING_SOLVED;
112112
const rating = shouldRemove ? baseRating * 10 : baseRating;

classes/ratings.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public static function moodleoverflow_sort_answers_by_ratings($posts) {
257257
$startother = 1;
258258
// Solved and helpful posts are first.
259259
foreach ($answerposts as $post) {
260-
if ($post->statusteacher == 1 && $post->statusstarter == 1) {
260+
if ($post->markedsolution == 1 && $post->markedhelpful == 1) {
261261
$sortedposts[$index] = $post;
262262
$index++;
263263
}
@@ -275,7 +275,7 @@ public static function moodleoverflow_sort_answers_by_ratings($posts) {
275275

276276
// Build the group of only solved posts.
277277
foreach ($answerposts as $post) {
278-
if ($post->statusteacher == 1 && $post->statusstarter == 0) {
278+
if ($post->markedsolution == 1 && $post->markedhelpful == 0) {
279279
$sortedposts[$index] = $post;
280280
$index++;
281281
}
@@ -289,7 +289,7 @@ public static function moodleoverflow_sort_answers_by_ratings($posts) {
289289

290290
// Build the group of only helpful posts.
291291
foreach ($answerposts as $post) {
292-
if ($post->statusteacher == 0 && $post->statusstarter == 1) {
292+
if ($post->markedsolution == 0 && $post->markedhelpful == 1) {
293293
$sortedposts[$index] = $post;
294294
$index++;
295295
}
@@ -303,7 +303,7 @@ public static function moodleoverflow_sort_answers_by_ratings($posts) {
303303

304304
// Build the group of only helpful posts.
305305
foreach ($answerposts as $post) {
306-
if ($post->statusteacher == 0 && $post->statusstarter == 1) {
306+
if ($post->markedsolution == 0 && $post->markedhelpful == 1) {
307307
$sortedposts[$index] = $post;
308308
$index++;
309309
}
@@ -317,7 +317,7 @@ public static function moodleoverflow_sort_answers_by_ratings($posts) {
317317

318318
// Build the group of only solved posts.
319319
foreach ($answerposts as $post) {
320-
if ($post->statusteacher == 1 && $post->statusstarter == 0) {
320+
if ($post->markedsolution == 1 && $post->markedhelpful == 0) {
321321
$sortedposts[$index] = $post;
322322
$index++;
323323
}
@@ -331,7 +331,7 @@ public static function moodleoverflow_sort_answers_by_ratings($posts) {
331331

332332
// Now build the group of posts without ratings like helpful/solved.
333333
foreach ($answerposts as $post) {
334-
if ($post->statusteacher == 0 && $post->statusstarter == 0) {
334+
if ($post->markedsolution == 0 && $post->markedhelpful == 0) {
335335
$sortedposts[$index] = $post;
336336
$index++;
337337
}

locallib.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -265,31 +265,31 @@ function moodleoverflow_print_latest_discussions($moodleoverflow, $cm, $page = -
265265
}
266266

267267
// Check if the question owner marked the question as helpful.
268-
$statusstarter = \mod_moodleoverflow\ratings::moodleoverflow_discussion_is_solved($discussion->discussion, false);
268+
$markedhelpful = \mod_moodleoverflow\ratings::moodleoverflow_discussion_is_solved($discussion->discussion, false);
269269
$preparedarray[$i]['starterlink'] = null;
270-
if ($statusstarter) {
270+
if ($markedhelpful) {
271271
$link = '/mod/moodleoverflow/discussion.php?d=';
272-
$statusstarter = $statusstarter[array_key_first($statusstarter)];
272+
$markedhelpful = $markedhelpful[array_key_first($markedhelpful)];
273273

274274
$preparedarray[$i]['starterlink'] = new moodle_url($link .
275-
$statusstarter->discussionid . '#p' . $statusstarter->postid);
275+
$markedhelpful->discussionid . '#p' . $markedhelpful->postid);
276276
}
277277

278278
// Check if a teacher marked a post as solved.
279-
$statusteacher = \mod_moodleoverflow\ratings::moodleoverflow_discussion_is_solved($discussion->discussion, true);
279+
$markedsolution = \mod_moodleoverflow\ratings::moodleoverflow_discussion_is_solved($discussion->discussion, true);
280280
$preparedarray[$i]['teacherlink'] = null;
281-
if ($statusteacher) {
281+
if ($markedsolution) {
282282
$link = '/mod/moodleoverflow/discussion.php?d=';
283-
$statusteacher = $statusteacher[array_key_first($statusteacher)];
283+
$markedsolution = $markedsolution[array_key_first($markedsolution)];
284284

285285
$preparedarray[$i]['teacherlink'] = new moodle_url($link .
286-
$statusteacher->discussionid . '#p' . $statusteacher->postid);
286+
$markedsolution->discussionid . '#p' . $markedsolution->postid);
287287
}
288288

289289
// Check if a single post was marked by the question owner and a teacher.
290290
$statusboth = false;
291-
if ($statusstarter && $statusteacher) {
292-
if ($statusstarter->postid == $statusteacher->postid) {
291+
if ($markedhelpful && $markedsolution) {
292+
if ($markedhelpful->postid == $markedsolution->postid) {
293293
$statusboth = true;
294294
}
295295
}
@@ -401,8 +401,8 @@ function moodleoverflow_print_latest_discussions($moodleoverflow, $cm, $page = -
401401
$preparedarray[$i]['linktopopup'] = $linktopopup;
402402

403403
// Add all created data to an array.
404-
$preparedarray[$i]['statusstarter'] = $statusstarter;
405-
$preparedarray[$i]['statusteacher'] = $statusteacher;
404+
$preparedarray[$i]['markedhelpful'] = $markedhelpful;
405+
$preparedarray[$i]['markedsolution'] = $markedsolution;
406406
$preparedarray[$i]['statusboth'] = $statusboth;
407407
$preparedarray[$i]['votes'] = $votes;
408408

@@ -1059,8 +1059,8 @@ function moodleoverflow_get_all_discussion_posts($discussionid, $tracking, $modc
10591059
$posts[$postid]->upvotes = $discussionratings[$post->id]->upvotes;
10601060
$posts[$postid]->downvotes = $discussionratings[$post->id]->downvotes;
10611061
$posts[$postid]->votesdifference = $posts[$postid]->upvotes - $posts[$postid]->downvotes;
1062-
$posts[$postid]->statusstarter = $discussionratings[$post->id]->ishelpful;
1063-
$posts[$postid]->statusteacher = $discussionratings[$post->id]->issolved;
1062+
$posts[$postid]->markedhelpful = $discussionratings[$post->id]->ishelpful;
1063+
$posts[$postid]->markedsolution = $discussionratings[$post->id]->issolved;
10641064
}
10651065

10661066
// Order the answers by their ratings.
@@ -1240,7 +1240,7 @@ function moodleoverflow_print_post($post, $discussion, $moodleoverflow, $cm, $co
12401240
if ($canmarkhelpful) {
12411241
// When the post is already marked, remove the mark instead.
12421242
$link = '/mod/moodleoverflow/discussion.php';
1243-
if ($post->statusstarter) {
1243+
if ($post->markedhelpful) {
12441244
$commands[] = html_writer::tag('a', $str->marknothelpful,
12451245
array('class' => 'markhelpful onlyifreviewed', 'role' => 'button', 'data-moodleoverflow-action' => 'helpful'));
12461246
} else {
@@ -1262,7 +1262,7 @@ function moodleoverflow_print_post($post, $discussion, $moodleoverflow, $cm, $co
12621262

12631263
// When the post is already marked, remove the mark instead.
12641264
$link = '/mod/moodleoverflow/discussion.php';
1265-
if ($post->statusteacher) {
1265+
if ($post->markedsolution) {
12661266
$commands[] = html_writer::tag('a', $str->marknotsolved,
12671267
array('class' => 'marksolved onlyifreviewed', 'role' => 'button', 'data-moodleoverflow-action' => 'solved'));
12681268
} else {
@@ -1335,8 +1335,8 @@ function moodleoverflow_print_post($post, $discussion, $moodleoverflow, $cm, $co
13351335
$mustachedata->votes = $post->upvotes - $post->downvotes;
13361336

13371337
// Check if the post is marked.
1338-
$mustachedata->statusstarter = $post->statusstarter;
1339-
$mustachedata->statusteacher = $post->statusteacher;
1338+
$mustachedata->markedhelpful = $post->markedhelpful;
1339+
$mustachedata->markedsolution = $post->markedsolution;
13401340

13411341
// Did the user rated this post?
13421342
$rating = \mod_moodleoverflow\ratings::moodleoverflow_user_rated($post->id);
@@ -1377,11 +1377,11 @@ function moodleoverflow_print_post($post, $discussion, $moodleoverflow, $cm, $co
13771377
}
13781378
}
13791379
}
1380-
if ($post->statusstarter) {
1381-
$postclass .= ' statusstarter';
1380+
if ($post->markedhelpful) {
1381+
$postclass .= ' markedhelpful';
13821382
}
1383-
if ($post->statusteacher) {
1384-
$postclass .= ' statusteacher';
1383+
if ($post->markedsolution) {
1384+
$postclass .= ' markedsolution';
13851385
}
13861386
$mustachedata->postclass = $postclass;
13871387

styles.css

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
width: 4px;
192192
}
193193

194-
.moodleoverflowpost.statusteacher.statusstarter:before {
194+
.moodleoverflowpost.markedsolution.markedhelpful:before {
195195
background: linear-gradient(80deg, rgba(234, 133, 22, 1) 50%, rgba(112, 160, 52, 1) 50%);
196196
bottom: -1px;
197197
content: "";
@@ -202,7 +202,7 @@
202202
width: 4px;
203203
}
204204

205-
.moodleoverflowpost.statusteacher:before {
205+
.moodleoverflowpost.markedsolution:before {
206206
background: rgba(112, 160, 52, 1);
207207
bottom: -1px;
208208
content: "";
@@ -213,7 +213,7 @@
213213
width: 4px;
214214
}
215215

216-
.moodleoverflowpost.statusstarter:before {
216+
.moodleoverflowpost.markedhelpful:before {
217217
background: rgba(234, 133, 22, 1);
218218
bottom: -1px;
219219
content: "";
@@ -229,11 +229,11 @@
229229
display: none;
230230
}
231231

232-
.moodleoverflowpost.statusstarter .onlyifhelpful {
232+
.moodleoverflowpost.markedhelpful .onlyifhelpful {
233233
display: initial;
234234
}
235235

236-
.moodleoverflowpost.statusteacher .onlyifsolved {
236+
.moodleoverflowpost.markedsolution .onlyifsolved {
237237
display: initial;
238238
}
239239

templates/discussion_list.mustache

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,23 @@
119119
{{#pix}}i/duration, moodle, {{#str}}pending_review, mod_moodleoverflow{{/str}}{{/pix}}
120120
{{/ questionunderreview }}
121121
{{^ questionunderreview }}
122-
{{#statusteacher}}
122+
{{#markedsolution}}
123123
<a href="{{teacherlink}}">
124124
{{# pix}} status/c_outline, moodleoverflow, {{#str}}teacherrating, moodleoverflow{{/str}} {{/ pix}}
125125
</a>
126-
{{/statusteacher}}
127-
{{^statusteacher}}
126+
{{/markedsolution}}
127+
{{^markedsolution}}
128128
{{# pix}} status/c_blank, moodleoverflow, {{#str}}marknotsolved, moodleoverflow{{/str}}{{/ pix}}
129-
{{/statusteacher}}
129+
{{/markedsolution}}
130130

131-
{{#statusstarter}}
131+
{{#markedhelpful}}
132132
<a href="{{starterlink}}">
133133
{{# pix}} status/b_outline, moodleoverflow, {{#str}}starterrating, moodleoverflow{{/str}} {{/ pix}}
134134
</a>
135-
{{/statusstarter}}
136-
{{^statusstarter}}
135+
{{/markedhelpful}}
136+
{{^markedhelpful}}
137137
{{# pix}} status/b_blank, moodleoverflow, {{#str}}marknothelpful, moodleoverflow{{/str}} {{/ pix}}
138-
{{/statusstarter}}
138+
{{/markedhelpful}}
139139
{{/ questionunderreview }}
140140
</td>
141141

0 commit comments

Comments
 (0)