<commit_before><?php
namespace Minds\Core\Boost\Network\Delegates;

use Minds\Core;
use Minds\Core\Boost\Network\Boost;

class AnalyticsDelegate implements BoostDelegateInterface
{
    /**
     * Called when a boost is added
     * @param Boost $boost
     * @return void
     */
    public function onAdd(Boost $boost): void
    {
        $event = new Core\Analytics\Metrics\Event();
        $event->setType('action')
            ->setAction('boost')
            ->setProduct('boost')
            ->setUserGuid((string) $boost->getGuid())
            ->setEntityGuid((string) $boost->getGuid()) // Note its the boost guid and not the entity being boosted
            ->setEntityType('boost')
            ->setEntityOwnerGuid($boost->getOwnerGuid())
            ->setBoostEntityGuid($boost->getEntityGuid())
            ->setBoostType($boost->getType())
            ->push();<commit_msg>(fix): set the current session for boost analytics events<commit_after><?php
namespace Minds\Core\Boost\Network\Delegates;

use Minds\Core;
use Minds\Core\Boost\Network\Boost;

class AnalyticsDelegate implements BoostDelegateInterface
{
    /**
     * Called when a boost is added
     * @param Boost $boost
     * @return void
     */
    public function onAdd(Boost $boost): void
    {
        $event = new Core\Analytics\Metrics\Event();
        $event->setType('action')
            ->setAction('boost')
            ->setProduct('boost')
            ->setUserGuid(Core\Session::getLoggedInUserGuid())
            ->setEntityGuid((string) $boost->getGuid()) // Note its the boost guid and not the entity being boosted
            ->setEntityType('boost')
            ->setEntityOwnerGuid($boost->getOwnerGuid())
            ->setBoostEntityGuid($boost->getEntityGuid())
            ->setBoostType($boost->getType())
            ->push();
{'fraction_non_alphanumeric': 0.13519430760810072, 'fraction_numerical': 0.0, 'mean_word_length': 2.5984251968503935, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6433267', 'n_tokens_mistral': 507, 'n_tokens_neox': 500, 'n_words': 112}