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

May 2025

M T W T F S S
    1 23 4
5 67 8 91011
12 13 1415 161718
1920 21 2223 2425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 25 May 2025 04:50 am
Powered by Dreamwidth Studios