igenlode: The pirate sloop 'Horizon' from "Treasures of the Indies" (Default)
[personal profile] igenlode
I managed to notice the first serious bug in my AO3 stats script, when "High City on a Hill" failed to show up as having any new hits at all for the month of March.

Because awk handles all input as text by default, the values for the number of hits etc. are being saved as text strings instead of numeric values, which means that in a comparison "6" is treated as greater than "3", but "112" is treated as less than "31" (because "1" at the start of the 'word' is less than "3"). So if the difference between two values is sufficiently large for them to have a differing number of digits, the results of the comparison become entirely spurious :-p

The answer is to multiply all values which are intended to be numeric by 1, in order to ensure that awk knows to store (and compare) them as numbers and not strings!

Profile

igenlode: The pirate sloop 'Horizon' from "Treasures of the Indies" (Default)
Igenlode Wordsmith

December 2025

M T W T F S S
123 4 567
8 9 101112 1314
1516 1718 19 20 21
222324 25 2627 28
293031    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 29 December 2025 01:10 am
Powered by Dreamwidth Studios