Skip to content

Commit bf93575

Browse files
committed
coding style
1 parent c76720f commit bf93575

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

classes/ratings.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -229,14 +229,14 @@ public static function moodleoverflow_get_reputation($moodleoverflowid, $userid
229229

230230
/**
231231
* Sort the answers of a discussion by their marks and votes.
232-
*
232+
*
233233
* @param object $posts all the posts from a discussion.
234234
*/
235235
public static function moodleoverflow_sort_answers_by_ratings($posts) {
236236
// Create a copy that only has the answer posts and save the parent post.
237237
$answerposts = $posts;
238238
$parentpost = array_shift($answerposts);
239-
239+
240240
// Create an empty array for the sorted posts and add the parent post.
241241
$sortedposts = array();
242242
$sortedposts[0] = $parentpost;
@@ -264,7 +264,7 @@ public static function moodleoverflow_sort_answers_by_ratings($posts) {
264264
$index++;
265265
}
266266
}
267-
//Update the indices and sort the group by votes.
267+
// Update the indices and sort the group by votes.
268268
if ($index > $startsolvedandhelpful) {
269269
$startsolved = $index;
270270
$starthelpful = $index;
@@ -349,7 +349,7 @@ public static function moodleoverflow_sort_answers_by_ratings($posts) {
349349
foreach ($sortedposts as $post) {
350350
$neworder[$post->id] = $post;
351351
}
352-
352+
353353
// return now the sorted posts.
354354
return $neworder;
355355
}

tests/ratings_test.php

+8-9
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
* @copyright 2023 Tamaro Walter
3838
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
3939
*/
40-
class ratings_test extends \advanced_testcase {
40+
class ratings_test extends \advanced_testcase {
4141
/** @var \stdClass test course */
4242
private $course;
4343

@@ -101,7 +101,7 @@ public function tearDown(): void {
101101
}
102102

103103
// Begin of test functions
104-
104+
105105
/**
106106
* Test, if rating can sort after ever group with ratingpreferences on helpful first.
107107
*/
@@ -126,7 +126,6 @@ public function test_sort_answer_by_ratings() {
126126
$result = $this->postsorderequal($sortedposts, $rightorderposts);
127127
$this->assertEquals(1, $result);
128128

129-
130129
// Test without posts that are only marked as solved
131130
$posts = array($this->post, $this->answer1, $this->answer3, $this->answer4, $this->answer5, $this->answer6);
132131
$this->set_ratingpreferences(0);
@@ -171,7 +170,7 @@ public function test_sort_answer_by_ratings() {
171170
}
172171

173172
// Helper functions
174-
173+
175174
/**
176175
* This function creates:
177176
* - a course with a moodleoverflow
@@ -211,7 +210,7 @@ private function helper_course_set_up() {
211210

212211
/**
213212
* This function compares 2 arrays with posts and checks if the order is the same.
214-
*
213+
*
215214
* @param array $sortedposts - The sorted posts
216215
* @param array $rightorderposts - The posts with the order they should have
217216
* The function returns 1 if $sortedposts matches $posts, else 0
@@ -268,14 +267,14 @@ private function create_everygroup() {
268267
$this->answer1->votesdifference = $this->answer1->upvotes - $this->answer1->downvotes;
269268
$this->answer1->markedhelpful = 1;
270269
$this->answer1->markedsolution = 1;
271-
270+
272271
// Answer2.
273272
$this->answer2->upvotes = 0;
274273
$this->answer2->downvotes = 0;
275274
$this->answer2->votesdifference = $this->answer2->upvotes - $this->answer2->downvotes;
276275
$this->answer2->markedhelpful = 0;
277276
$this->answer2->markedsolution = 1;
278-
277+
279278
// Answer3.
280279
$this->answer3->upvotes = 0;
281280
$this->answer3->downvotes = 0;
@@ -305,6 +304,6 @@ private function create_everygroup() {
305304
$this->answer6->markedsolution = 0;
306305
}
307306

308-
//private function create_groupswithoutsolution
309-
307+
// private function create_groupswithoutsolution
308+
310309
}

0 commit comments

Comments
 (0)