Skip to content

Commit

Permalink
Merge pull request #3786 from nextcloud/enh/maintenance
Browse files Browse the repository at this point in the history
small fixes
  • Loading branch information
dartcafe authored Nov 29, 2024
2 parents cc1b76c + 9607faf commit cb073c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions lib/Service/SystemService.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function getSiteUsersAndGroups(string $query = ''): array {
* get a list of user objects from the backend matching the query string
*/
public function search(string $query = ''): array {
$startSearchTimer = microtime(true);
$items = [];
$types = [
IShare::TYPE_USER,
Expand All @@ -91,8 +92,9 @@ public function search(string $query = ''): array {
// Add circles to the search, if app is enabled
$types[] = IShare::TYPE_CIRCLE;
}

$startCollaborationSearchTimer = microtime(true);
[$result, $more] = $this->userSearch->search($query, $types, false, $maxResults, 0);
$this->logger->debug('Search took {time}s', ['time' => microtime(true) - $startCollaborationSearchTimer]);

if ($more) {
$this->logger->info('Only first {maxResults} matches will be returned.', ['maxResults' => $maxResults]);
Expand Down Expand Up @@ -150,7 +152,7 @@ public function search(string $query = ''): array {
$items[] = $this->userMapper->getUserObject(Circle::TYPE, $item['value']['shareWith'])->getRichUserArray();
}
}

$this->logger->debug('Search took {time}s overall', ['time' => microtime(true) - $startSearchTimer]);
return $items;
}

Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/Db/OptionMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Polls\Db;
namespace OCA\Polls\Tests\Unit\Db;

use OCA\Polls\Tests\Unit\UnitTestCase;

Expand All @@ -24,11 +24,11 @@ class OptionMapperTest extends UnitTestCase {
private OptionMapper $optionMapper;
private PollMapper $pollMapper;
private VoteMapper $voteMapper;
/** @var Poll[] $polls */
/** @var Poll[] $polls */
private array $polls = [];
/** @var Option[] $options */
/** @var Option[] $options */
private array $options = [];
/** @var Vote[] $votes */
/** @var Vote[] $votes */
private array $votes = [];

/**
Expand All @@ -52,13 +52,13 @@ protected function setUp(): void {

for ($count = 0; $count < 2; $count++) {

/** @var Option $option */
/** @var Option $option */
$option = $this->fm->instance('OCA\Polls\Db\Option');
$option->setPollId($poll->getId());
$option->syncOption();
array_push($this->options, $this->optionMapper->insert($option));

/** @var Vote $vote */
/** @var Vote $vote */
$vote = $this->fm->instance('OCA\Polls\Db\Vote');
$vote->setPollId($option->getPollId());
$vote->setUserId('TestUser');
Expand Down

0 comments on commit cb073c9

Please sign in to comment.