Skip to content

Commit

Permalink
Allow cross-reporting-window event-level-report prioritization
Browse files Browse the repository at this point in the history
  • Loading branch information
apasel422 committed Nov 13, 2023
1 parent acf0219 commit c85f791
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2692,11 +2692,21 @@ and an optional [=attribution report=] <dfn for="obtain debug data on trigger re
<h3 algorithm id="triggering-event-level-attribution">Triggering event-level attribution</h3>

An [=event-level report=] |a| <dfn for="event-level report">is lower-priority than</dfn>
an [=event-level report=] |b| if any of the following are true:

* |a|'s [=event-level report/trigger priority=] is less than |b|'s [=event-level report/trigger priority=].
* |a|'s [=event-level report/trigger priority=] is equal to |b|'s [=event-level report/trigger priority=]
and |a|'s [=event-level report/trigger time=] is greater than |b|'s [=event-level report/trigger time=].
an [=event-level report=] |b| if the following steps return true:

1. If |a|'s [=event-level report/report time=] is greater than |b|'s
[=event-level report/report time=], return true.
1. If |a|'s [=event-level report/report time=] is less than |b|'s
[=event-level report/report time=], return false.
1. If |a|'s [=event-level report/trigger priority=] is less than |b|'s
[=event-level report/trigger priority=], return true.
1. If |a|'s [=event-level report/trigger priority=] is greater than |b|'s
[=event-level report/trigger priority=], return false.
1. If |a|'s [=event-level report/trigger time=] is greater than |b|'s
[=event-level report/trigger time=], return true.
1. If |a|'s [=event-level report/trigger time=] is less than |b|'s
[=event-level report/trigger time=], return false.
1. Return false.

An <dfn>event-level-report-replacement result</dfn> is one of the following:

Expand All @@ -2722,7 +2732,16 @@ To <dfn>maybe replace event-level report</dfn> given an [=attribution source=]
|sourceToAttribute|'s [=attribution source/max number of event-level reports=].
1. If |sourceToAttribute|'s [=attribution source/number of event-level reports=] is less than
|sourceToAttribute|'s [=attribution source/max number of event-level reports=], return "<code>[=event-level-report-replacement result/add-new-report=]</code>".
1. Let |matchingReports| be a new [=list=] whose elements are all the elements in the [=event-level report cache=] whose [=event-level report/report time=] and [=event-level report/source identifier=] are equal to |report|'s, [=list/sorted in ascending order=] using [=event-level report/is lower-priority than=].
1. Let |matchingReports| be a new [=list=].
1. [=set/iterate|For each=] |candidate| of the [=event-level report cache=]:
1. If |report|'s [=event-level report/source identifier=] does not equal
|candidate|'s, [=iteration/continue=].
1. If |report|'s [=event-level report/trigger time=] is greater than or
equal to |candidate|'s [=event-level report/report time=],
[=iteration/continue=].
1. [=list/Append=] |candidate| to |matchingReports|.
1. [=list/sort|Sort=] |matchingReports| in ascending order using
[=event-level report/is lower-priority than=].
1. If |matchingReports| [=list/is empty=]:
1. Set |sourceToAttribute|'s [=attribution source/event-level attributable=] value to false.
1. Return "<code>[=event-level-report-replacement result/drop-new-report-none-to-replace=]</code>".
Expand Down

0 comments on commit c85f791

Please sign in to comment.