Skip to content

Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
Minds Backend - Engine
Minds Backend - Engine
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
    • Insights
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
    • Locked Files
  • Issues 201
    • Issues 201
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 40
    • Merge Requests 40
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Security & Compliance
    • Security & Compliance
    • Dependency List
  • Packages
    • Packages
    • List
    • Container Registry
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Minds
  • Minds Backend - EngineMinds Backend - Engine
  • Merge Requests
  • !235

Our Privacy Policy has changed, please visit https://about.gitlab.com/privacy to review these changes.

Open
Opened 2 months ago by Emiliano Balbuena@edgebal
  • Report abuse
Report abuse

WIP: Boost Campaigns (&24)

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b "goal/boost-campaigns-e24" "origin/goal/boost-campaigns-e24"

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout "origin/master"
git merge --no-ff "goal/boost-campaigns-e24"

Step 4. Push the result of the merge to GitLab

git push origin "master"

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

Request to merge goal/boost-campaigns-e24 into master
The source branch is 44 commits behind the target branch
Open in Web IDE
  • Email patches
  • Plain diff
Pipeline #80035488 passed for b6e5b996 on goal/boost-campaigns-e24
          Requires 2 more approvals from Devs.
          Brian Hatchet
          Brian Hatchet
          Mark Harding
          Mark Harding
          Ben Hayward
          Ben Hayward
          Marcelo Rivera
          Marcelo Rivera
          Rami Albatal
          Rami Albatal
          There are merge conflicts. Resolve these conflicts or ask someone with write access to this repository to merge it locally

          Deletes source branch

          You can merge this merge request manually using the
          • Discussion 9
          • Commits 90
          • Pipelines 57
          • Changes 67
          0/6 threads resolved
          • Loading...
          • Emiliano Balbuena @edgebal mentioned in merge request !207 (closed) 2 months ago

            mentioned in merge request !207 (closed)

          • Emiliano Balbuena @edgebal added MR::Awaiting Review scoped label 2 months ago

            added MR::Awaiting Review scoped label

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • d587d4cf - (wip)(refactor): Campaigns should use their own ES index and cql table

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 99168bdd - (chore): Lifecycle tweaks

            Compare with previous version

          • Emiliano Balbuena @edgebal added 16 commits 2 months ago

            added 16 commits

            • 99168bdd...1674767b - 15 commits from branch master
            • fdfd433c - Merge remote-tracking branch 'upstream/master' into goal/boost-campaigns-e24

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • a95f6094 - (chore): Revert Network Boost changes

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 797d592d - (chore): Revert root Boost Repository

            Compare with previous version

          • Marcelo Rivera @eiennohi added 3 commits 2 months ago

            added 3 commits

            • 186b42e9 - (feat): queue runner for completing boosts
            • ee60ae69 - (feat): boost campaigns iterator
            • 5cd99f03 - (feat): BoostCampaigns starter CLI

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • eaacfe65 - (wip): Payments

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • f9ea874b - (wip)(refactor): Payments

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 68a973d9 - (test): Fix blockchain spec tests

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 41ae7d2a - (wip): Onchain payments

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • c64885d2 - (feat): Lifecycle based on payment events

            Compare with previous version

          • Marcelo Rivera @eiennohi added 4 commits 2 months ago

            added 4 commits

            • c5348209 - (feat): added rating and quality to Campaign entity
            • 3905dd69 - (feat): updated campaign repositories to also make use of rating and quality
            • 51c8ca06 - (feat): Campaigns/Iterator can now filter by rating and quality
            • 53dffa04 - (feat): v2/boost/fetch/campaigns

            Compare with previous version

            Toggle commit list
          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • 78104aa8 - (feat): v2/boost/fetch/campaigns

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 434afa0a - (wip): Metrics

            Compare with previous version

          • Emiliano Balbuena @edgebal added 18 commits 2 months ago

            added 18 commits

            • 434afa0a...5797d6ea - 16 commits from branch master
            • 986398b1 - (chore): Tweaks on Resolver ACL ignoring
            • e83768eb - Merge remote-tracking branch 'upstream/master' into goal/boost-campaigns-e24

            Compare with previous version

          • Marcelo Rivera @eiennohi added 3 commits 2 months ago

            added 3 commits

            • a5e57551 - (fix): moved sorting to ES
            • 6e862c12 - (fix): remove unused $next array
            • 2a77703e - (feat): calculate campaign rating based on nsfw value

            Compare with previous version

          • Marcelo Rivera @eiennohi added 2 commits 2 months ago

            added 2 commits

            • d8a8fbf1 - (fix): use _index vs index
            • 836245a1 - (fix): double declaration error, add timestamp

            Compare with previous version

          • Ben Hayward
            Ben Hayward @benhayward.ben · 2 months ago
            Developer

            Is this awaiting review with a WIP: accidentally left on, or the other way around?

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 130b7876 - (feat): Refunds

            Compare with previous version

          • Emiliano Balbuena @edgebal removed MR::Awaiting Review label 2 months ago

            removed MR::Awaiting Review label

          • Emiliano Balbuena @edgebal added 30 commits 2 months ago

            added 30 commits

            • 130b7876...e33eedaf - 29 commits from branch master
            • 8f3875e0 - Merge remote-tracking branch 'origin/master' into goal/boost-campaigns-e24

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • a6f14b0f - (feat): add date validation

            Compare with previous version

          • Mark Harding @markeharding added Squad::Yellow scoped label 2 months ago

            added Squad::Yellow scoped label

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 23abc088 - (chore): Add `cpm` to settings

            Compare with previous version

          • Emiliano Balbuena @edgebal added 9 commits 2 months ago

            added 9 commits

            • 23abc088...88286ad8 - 8 commits from branch master
            • f9178dcc - Merge remote-tracking branch 'origin/master' into goal/boost-campaigns-e24

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 635f25dc - (wip): Campaign stats preview

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • 3e9e4235 - (feat): implemented new offsets from v2/boost/feeds

            Compare with previous version

          • Marcelo Rivera @eiennohi added 2 commits 2 months ago

            added 2 commits

            • 92748bec - (feat): implemented new offsets from v2/boost/feeds
            • 683c8704 - (fix): if offset isn't cached, set it as 0

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • da99f974 - (fix): check $data[0] vs $next

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • 50260574 - (fix): rating filtering

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • e690c3b3 - (fix): 1 = safe; 2 = open

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • d5aeeb74 - (fix): 1 = safe; 2 = open

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • 7605ba61 - (fix): quality filtering

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • 09adb0ac - (fix): disable caching for now

            Compare with previous version

          • Marcelo Rivera @eiennohi added 2 commits 2 months ago

            added 2 commits

            • c34608ff - (fix): $cacheKey should consider quality and rating
            • 3f3f52ec - (fix): ios and new users check should be done before checking cache

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • a821454e - (fix): Resolve campaigns

            Compare with previous version

          • Emiliano Balbuena @edgebal added 11 commits 2 months ago

            added 11 commits

            • a821454e...3f81d85a - 9 commits from branch master
            • 89ef1571 - Merge remote-tracking branch 'origin/master' into goal/boost-campaigns-e24
            • 7fb97f93 - (test): Fix foreign test failures due to Resolver changes

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 9ca3cbb4 - (fix): Circular DI issue on Entities\Resolver

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • e9a5016e - (fix): Campaigns not being listed because of defaults

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • d3ebab5d - (chore): Default CPM

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • 843b09fc - (fix): should return 'entities' vs 'boosts'

            Compare with previous version

          • Marcelo Rivera @eiennohi added 2 commits 2 months ago

            added 2 commits

            • f151d290 - (feat): check if entity exists before mapping
            • c1da061f - (fix): send urn vs string when resolving boosted entity

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 2 months ago

            added 1 commit

            • ea54fea4 - (chore): PHPDoc for Resolver->single

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • a6d916e7 - (fix): Counters

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 8149cde1 - (fix): Operator relevance on CPM default

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • 6dead061 - (fix): Wrong state check when completing

            Compare with previous version

          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 2 months ago
            Core/Boost/Campaigns/Delegates/NormalizeDatesDelegate.php
            27
            28 $today = strtotime(date('Y-m-d') . ' 00:00:00') * 1000;
            29 $start = strtotime(date('Y-m-d', $start) . ' 00:00:00') * 1000;
            30 $end = strtotime(date('Y-m-d', $end) . ' 23:59:59') * 1000;
            31
            32 if ($start < $today) {
            33 throw new CampaignException('Campaign start should not be in the past');
            34 } elseif ($start >= $end) {
            35 throw new CampaignException('Campaign end before starting');
            36 }
            37
            38 $campaign
            39 ->setStart($start)
            40 ->setEnd($end);
            41
            42 return $campaign;
            • Mark Harding
              Mark Harding @markeharding · 2 months ago
              Owner

              I think, generally, delegates should not return values and be void?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 2 months ago
            Core/Boost/Campaigns/Delegates/NormalizeDatesDelegate.php
            27
            28 $today = strtotime(date('Y-m-d') . ' 00:00:00') * 1000;
            29 $start = strtotime(date('Y-m-d', $start) . ' 00:00:00') * 1000;
            30 $end = strtotime(date('Y-m-d', $end) . ' 23:59:59') * 1000;
            31
            32 if ($start < $today) {
            33 throw new CampaignException('Campaign start should not be in the past');
            34 } elseif ($start >= $end) {
            35 throw new CampaignException('Campaign end before starting');
            36 }
            37
            38 $campaign
            39 ->setStart($start)
            40 ->setEnd($end);
            41
            42 return $campaign;
            • Mark Harding
              Mark Harding @markeharding · 2 months ago
              Owner

              also, some PHP 7 scala typing would be :tada:

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on an old version of the diff 2 months ago
            Last updated by Emiliano Balbuena 1 month ago
            Core/Boost/Campaigns/Iterator.php
            118 return $this;
            119 }
            120
            121 /**
            122 * @param int $quality
            123 * @return Iterator
            124 */
            125 public function setQuality(int $quality)
            126 {
            127 $this->quality = $quality;
            128 return $this;
            129 }
            130
            131 public function getList()
            132 {
            133 $response = $this->manager->getList(['limit' => $this->limit, 'from' => $this->from, 'offset' => $this->offset, 'type' => $this->type, 'owner_guid' => $this->ownerGuid, 'state' => $this->state, 'rating' => $this->rating, 'quality' => $this->quality,]);
            • Mark Harding
              Mark Harding @markeharding · 2 months ago
              Owner

              can we format this?

            • Emiliano Balbuena @edgebal changed this line in version 55 of the diff 1 month ago

              changed this line in version 55 of the diff

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on an old version of the diff 2 months ago
            Last updated by Emiliano Balbuena 1 month ago
            Core/Entities/Resolver.php
            125 131
            126 132 $sorted = array_filter($sorted, function ($entity) { return (bool) $entity; });
            127 133
            128 // Filter out forbidden entities
            134 // Filter out forbidden entities, if not ignoring ACL
            135
            136 $ignoreAcl = $this->opts['ignoreAcl'] ?? false;
            129 137
            130 $sorted = array_filter($sorted, function ($entity) {
            131 return $this->acl->read($entity, $this->user);
            132 //&& !Flags::shouldFail($entity);
            133 });
            138 if (!$ignoreAcl) {
            • Mark Harding
              Mark Harding @markeharding · 2 months ago
              Owner

              Should this not be the job of the Security\ACL::$ignore? cc\ @brianhatchet with his new RBAC wisdom.

            • Mark Harding
              Mark Harding @markeharding · 2 months ago
              Owner

              patching the acl skipping in multiple different places doesn't seem right

            • Emiliano Balbuena @edgebal changed this line in version 55 of the diff 1 month ago

              changed this line in version 55 of the diff

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on an old version of the diff 2 months ago
            Last updated by Emiliano Balbuena 1 month ago
            Core/Boost/Campaigns/Repository.php
            39 throw new NotImplementedException();
            40 }
            41
            42 /**
            43 * @param Campaign $campaign
            44 * @return bool
            45 * @throws Exception
            46 */
            47 public function add(Campaign $campaign)
            48 {
            49 $cql = "INSERT INTO boost_campaigns (type, guid, owner_guid, json_data, delivery_status) VALUES (?, ?, ?, ?, ?)";
            50 $values = [
            51 $campaign->getType(),
            52 new Varint($campaign->getGuid()),
            53 new Varint($campaign->getOwnerGuid()),
            54 json_encode([
            • Mark Harding
              Mark Harding @markeharding · 2 months ago
              Owner

              Perhaps move this outside of values to avoid confusion?

            • Emiliano Balbuena @edgebal changed this line in version 55 of the diff 1 month ago

              changed this line in version 55 of the diff

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding · 2 months ago
            Owner

            Looking good from a first quick glance! ACl needs some clarification. Whats the remaining steps?

          • Emiliano Balbuena @edgebal added 1 commit 2 months ago

            added 1 commit

            • f1f564ce - (fix): Only owners can list/read their campaigns

            Compare with previous version

          • Marcelo Rivera @eiennohi added 2 commits 1 month ago

            added 2 commits

            • 03deb56d - (feat): save impressions_met to ES every 10 views
            • 837dbad6 - (feat): implement type filtering

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 1 month ago

            added 1 commit

            • f6e5ec0d - (fix): removed var_dump

            Compare with previous version

          • Marcelo Rivera @eiennohi added 1 commit 1 month ago

            added 1 commit

            • 329a40c3 - (feat): added 'boost-campaigns' feature flag to settings.example.php

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 month ago

            added 1 commit

            • 1f852b07 - (chore): Use decimal for payments; impressions threshold

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 month ago

            added 1 commit

            • f3b1fddd - (fix): Use Cassandra's Decimal type

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 month ago

            added 1 commit

            • 866a01b0 - (refactor): Single campaigns should be fetch from Cassandra

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 month ago

            added 1 commit

            • 09997460 - (fix): Synchronous queue save; update impression on revoke

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 month ago

            added 1 commit

            • f0b50533 - (fix): Send boosted onchain flag and right boosted flag

            Compare with previous version

          • Emiliano Balbuena @edgebal added 1 commit 1 month ago

            added 1 commit

            • 1acc4cd4 - (wip): Spec tests

            Compare with previous version

          • Emiliano Balbuena @edgebal mentioned in issue #695 (closed) 1 month ago

            mentioned in issue #695 (closed)

          • Emiliano Balbuena @edgebal added 2 commits 1 month ago

            added 2 commits

            • 24bd6128 - (refactor): Never ignore ACL when reading boosted campaign entities
            • 3f4e4d30 - (chore): Code style

            Compare with previous version

          • Emiliano Balbuena @edgebal added 53 commits 1 month ago

            added 53 commits

            • 3f4e4d30...720522f6 - 52 commits from branch master
            • ea338ca0 - Merge remote-tracking branch 'origin/master' into goal/boost-campaigns-e24

            Compare with previous version

          • Emiliano Balbuena @edgebal added 60 commits 3 weeks ago

            added 60 commits

            • ea338ca0...d684846f - 58 commits from branch master
            • 07fde853 - Merge remote-tracking branch 'origin/master' into goal/boost-campaigns-e24
            • b6e5b996 - (chore): cs fixes

            Compare with previous version

          • Guy Thouret @gthouret added Squad::Blue scoped label and automatically removed Squad::Yellow label 1 week ago

            added Squad::Blue scoped label and automatically removed Squad::Yellow label

          • Guy Thouret @gthouret unassigned @edgebal 1 week ago

            unassigned @edgebal

          • Guy Thouret
            Guy Thouret @gthouret started a thread on the diff 1 hour ago
            Core/Boost/Campaigns/Campaign.php
            53 * @method Campaign setCreatedTimestamp(int $createdTimestamp)
            54 * @method int getReviewedTimestamp()
            55 * @method Campaign setReviewedTimestamp(int $reviewedTimestamp)
            56 * @method int getRevokedTimestamp()
            57 * @method Campaign setRevokedTimestamp(int $revokedTimestamp)
            58 * @method int getRejectedTimestamp()
            59 * @method Campaign setRejectedTimestamp(int $rejectedTimestamp)
            60 * @method int getCompletedTimestamp()
            61 * @method Campaign setCompletedTimestamp(int $completedTimestamp)
            62 */
            63 class Campaign implements JsonSerializable
            64 {
            65 use MagicAttributes;
            66
            67 /** @var string */
            68 const PENDING_STATUS = 'pending';
            • Guy Thouret
              Guy Thouret @gthouret · 1 hour ago
              Developer

              Rename the status consts the other way round like STATUS_PENDING makes autocomplete present a list of possible statuses when you start typing STATUS_

            • Please register or sign in to reply
          • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
          Please register or sign in to reply
          0 Assignees
          None
          Assign to
          None
          Milestone
          None
          Assign milestone
          None
          Time tracking
          No estimate or time spent
          1
          Labels
          Squad::Blue
          Assign labels
          • View project labels
          Lock merge request
          Unlocked
          8
          8 participants
          user avatar
          Brian Hatchet
          user avatar
          Mark Harding
          user avatar
          Ben Hayward
          user avatar
          Marcelo Rivera
          user avatar
          Rami Albatal
          user avatar
          Martin Santangelo
          user avatar
          Guy Thouret
          Reference: minds/engine!235