Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • Sign in / Register
Minds Backend - Engine
Minds Backend - Engine
  • Project overview
  • Repository
  • Issues 293
  • Merge Requests 37
  • CI / CD
  • Security & Compliance
  • Packages
  • Wiki
  • Snippets
  • Members
  • Collapse sidebar
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Minds
  • Minds Backend - EngineMinds Backend - Engine
  • Merge Requests
  • !413

Open
Opened 2 days ago by Guy Thouret@gthouret
Report abuse

Extract record view details from analytics/views api call

The details of recording a view are hidden away inside the api call.

These details should be in a class (or set of classes) within the code base and be subject to testing with the API left to do it's job of parameter parsing and error handling.

The motivation for this refactor is the ongoing boost improvements. A critical piece of boost functionality that marks a boost as expired has been hidden away inside this seemingly unrelated API call.

Closes #1077

Testing Steps:

  • Scroll down newsfeed
  • Make a note of the view counters
  • Wait an indeterminate amount of time (Counters are stored on the entity within ES?)
  • Refresh page
  • The view counters should have increased by 1
Edited 5 hours ago by Guy Thouret
Request to merge extract-view-api-1077 into master
The source branch is 14 commits behind the target branch
Open in Web IDE
Pipeline #100660852 passed for 6cefab06 on extract-view-api-1077
          Requires 3 more approvals from Devs, Deployers, and QA.
          Rami Albatal
          Rami Albatal
          Marcelo Rivera
          Marcelo Rivera
          Mark Harding
          Mark Harding
          Emiliano Balbuena
          Emiliano Balbuena
          Brian Hatchet
          Brian Hatchet
          Ready to be merged automatically. Ask someone with write access to this repository to merge this request

          Closes #1077

          • Discussion 9
          • Commits 1
          • Pipelines 4
          • Changes 5
          0/3 threads resolved
          • Guy Thouret @gthouret added MR::Awaiting Review Product::Analytics Squad::Blue Type::Refactor scoped labels 2 days ago

            added scoped labels

          • Guy Thouret @gthouret changed the description 2 days ago

            changed the description

          • Guy Thouret @gthouret added 1 commit 2 days ago

            added 1 commit

            • eb34ad78 - Extract record view details from analytics/views api call - #1077

            Compare with previous version

          • Guy Thouret @gthouret added 1 commit 1 day ago

            added 1 commit

            • cebc9837 - Extract record view details from analytics/views api call - #1077

            Compare with previous version

          • Guy Thouret
            Guy Thouret @gthouret · 1 day ago
            Developer

            More regression...

            2019/12/04 15:36:51 [error] 9#9: *65 FastCGI sent in stderr: "PHP message: Exception #1575473811: TypeError: Return value of Minds\Core\Analytics\Views\Record::recordEntity() must be of the type bool, none returned in /var/www/Minds/engine/Core/Analytics/Views/Record.php:144
            Stack trace:
            #0 /var/www/Minds/engine/Controllers/api/v2/analytics/views.php(37): Minds\Core\Analytics\Views\Record->recordEntity()
            #1 /var/www/Minds/engine/Api/Factory.php(87): Minds\Controllers\api\v2\analytics\views->post(Array)
            #2 /var/www/Minds/engine/Controllers/api/api.php(81): Minds\Api\Factory::build(Array, Object(Zend\Diactoros\ServerRequest), Object(Zend\Diactoros\Response\JsonResponse))
            #3 /var/www/Minds/engine/Core/Router.php(157): Minds\Controllers\api\api->post(Array)
            #4 /var/www/Minds/engine/index.php(9): Minds\Core\Router->route()
            #5 {main}" while reading response header from upstream, client: 192.168.13.110, server: _, request: "POST /api/v2/analytics/views/activity/1041704347395690512 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "extract-view-api-1077.minds.io", referrer: "https://extract-view-api-1077.minds.io/newsfeed/subscriptions"
          • Guy Thouret
            Guy Thouret @gthouret · 1 day ago
            Developer

            Also...

            2019/12/04 15:37:08 [error] 9#9: *65 FastCGI sent in stderr: "PHP message: Attribute rejectReason is not defined in Minds\Core\Boost\Network\Boost (setRejectReason)" while reading response header from upstream, client: 192.168.13.110, server: _, request: "POST /api/v2/analytics/views/boost/1018217353512488976 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "extract-view-api-1077.minds.io", referrer: "https://extract-view-api-1077.minds.io/newsfeed/subscriptions"
          • Guy Thouret
            Guy Thouret @gthouret · 1 day ago
            Developer

            Objects of type Minds\Core\Boost\Network\Boost are what is read but the functions we pass that object to are actually expecting an object of type Minds\Entities\Boost\Network :thinking:

          • Guy Thouret
            Guy Thouret @gthouret · 1 day ago
            Developer

            This is a lift and shift of original functionality. We have two objects declared for the same thing??? I'm confused now.

          • Guy Thouret
            Guy Thouret @gthouret · 1 day ago
            Developer

            Minds\Entities\Boost\Network has a setRejectionReason method. Somebody made a typo with setRejectReason and this has never been caught????

          • Guy Thouret
            Guy Thouret @gthouret · 1 day ago
            Developer

            Should be setRejectedReason. Was being set by Boost\Network\Repository so never worked since that file was created.

          • Guy Thouret @gthouret added 1 commit 1 day ago

            added 1 commit

            • 6cefab06 - Extract record view details from analytics/views api call - #1077

            Compare with previous version

          • Guy Thouret @gthouret unmarked as a Work In Progress 21 hours ago

            unmarked as a Work In Progress

            • Brian Hatchet
              Brian Hatchet :speech_balloon: @brianhatchet · 14 hours ago
              Developer

              Needs testing instructions. How can I verify this?

            • Please register or sign in to reply
          • Brian Hatchet :speech_balloon: @brianhatchet assigned to @gthouret 14 hours ago

            assigned to @gthouret

          • Guy Thouret @gthouret changed the description 14 hours ago

            changed the description

          • Guy Thouret @gthouret changed the description 13 hours ago

            changed the description

          • Guy Thouret @gthouret changed the description 5 hours ago

            changed the description

          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 1 hour ago
            Core/Analytics/Views/Record.php
            1 <?php
            2
            3 namespace Minds\Core\Analytics\Views;
            4
            5 use Minds\Core;
            6 use Minds\Core\Di\Di;
            7 use Minds\Entities;
            8 use Minds\Helpers\Counters;
            9
            10 class Record
            • Mark Harding
              Mark Harding @markeharding · 1 hour ago
              Owner

              need phpdocs

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 1 hour ago
            Core/Analytics/Views/Record.php
            129 error_log($e->getMessage());
            130 }
            131 }
            132
            133 try {
            134 $this->manager->record(
            135 (new Core\Analytics\Views\View())
            136 ->setEntityUrn($entity->getUrn())
            137 ->setOwnerGuid((string) $entity->getOwnerGuid())
            138 ->setClientMeta($this->clientMeta)
            139 );
            140 } catch (\Exception $e) {
            141 error_log($e);
            142 }
            143
            144 Di::_()->get('Referrals\Cookie')
            • Mark Harding
              Mark Harding @markeharding · 1 hour ago
              Owner

              This should be injected in constructor or moved back to controller.

            • Please register or sign in to reply
          • Mark Harding @markeharding added MR::Requires Changes scoped label and automatically removed MR::Awaiting Review label 1 hour ago

            added scoped label and automatically removed label

          Please register or sign in to reply
          Assignee
          Guy Thouret's avatar
          Guy Thouret @gthouret
          None
          Milestone
          None
          Time tracking
          No estimate or time spent
          4
          Labels
          MR::Requires Changes Product::Analytics Squad::Blue Type::Refactor
          Lock merge request
          Unlocked
          10
          10 participants
          user avatar
          Rami Albatal
          user avatar
          Marcelo Rivera
          user avatar
          Mark Harding
          user avatar
          Emiliano Balbuena
          user avatar
          Brian Hatchet
          user avatar
          Olivia Madrid
          user avatar
          Ben Hayward
          Reference: minds/engine!413