• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Devex / article_json / 318 / 2
100%
master: 100%

Build:
DEFAULT BRANCH: master
Ran 20 Nov 2017 06:32PM UTC
Files 171
Run time 10s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

20 Nov 2017 06:29PM UTC coverage: 100.0%. Remained the same
ruby-head

push

travis-ci

nicolas-fricke
Rework algorithm to place additional elements

While the previous algorithm was better in saturating articles with
additional elements it did not perform well when placing a single
additional element into an article, this was always placed at the end.

Considering the known use-cases of this algorithm (placing ads or CTA
forms within an article), it seems more common that single elements are
placed than that the article is being saturated with additional
elements.

Outline of the new algorithm:
1. It calculates every how many characters (only considering paragraphs)
   an additional element should be inserted, given the number of
   additional elements provided
2. It then iterates over the existing elements within the article,
   inserting them into the resulting, merged article
3. As soon as it has passed the right amount characters, it checks if
   the current position is eligible for inserting an additional element
   (the previous element needs to be a paragraph and the following needs
   to be either a paragraph or a headline)
    a) If so, it inserts the additional element and recalculates in how
       many characters the next element should be inserted, based on the
       remaining number of characters and remaining additional elements
    b) If not, it keeps iterating over the article until it finds an
       eligible position and only then inserts the additional element
       and recalculates the number of characters until the next
       insertion
4. If there are still additional elements remaining which couldn't be
   inserted (due to not finding enough eligible positions), they are
   appended to the end of the article

4249 of 4249 relevant lines covered (100.0%)

19.06 hits per line

Source Files on job 318.2 (ruby-head)
  • Tree
  • List 0
  • Changed 9
  • Source Changed 6
  • Coverage Changed 9
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 318
  • Travis Job 318.2
  • 3be44e0b on github
  • Prev Job for ruby-head on master (#316.2)
  • Next Job for ruby-head on master (#320.2)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc