Author Topic: sort columns in stats export html  (Read 847 times)

rafatins

  • Newbie
  • *
  • Posts: 20
    • View Profile
sort columns in stats export html
« on: January 25, 2014, 04:27:03 PM »
Hello, when I export a GAME to html file, in browser I can sort all columns by clicking at the top of the column. But when I export the STATS html file, it does not work in the browser.

Have copied the script that takes TournamentExport.html and put in StatsExport.html, but not worked.

Please, what to do?

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5428
    • View Profile
Re: sort columns in stats export html
« Reply #1 on: January 27, 2014, 10:43:36 AM »
Try using the template attached to this post.  I've added the appropriate logic to make the columns sortable.  This will be the updated StatsExport.html template in 3.3 when released (soon, hopefully).

rafatins

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: sort columns in stats export html
« Reply #2 on: January 28, 2014, 06:53:28 PM »
Dear Mr. Cooper, it worked but with some problems. See https://googledrive.com/host/0B2wKdFdgDnquZ0p4RF9MNGIxLWM/ranking.html in the columns "Total Ganho", "Saldo" and "Tempo Jogado" are not being properly classificas. What can it be?

Corey Cooper

  • Administrator
  • Hero Member
  • *****
  • Posts: 5428
    • View Profile
Re: sort columns in stats export html
« Reply #3 on: January 29, 2014, 12:55:09 PM »
Within the Tournament Director application columns can be sorted appropriately because the application knows the type of each column value.  That is, it knows which are text and which are numeric.  And sorting values numerically is different than sorting values alphabetically.

The export has sorting added kind of as an afterthought.  Because of this, it doesn't know the type of each column and it therefore has to guess.  It's a very simple guess: it looks at the value of a column in the first row and checks each character, from left to right.  If it finds a letter first, it assumes it is text.  If it finds a number first, it assumes it is numeric.  It ignores anything not A through Z or 0 through 9.  (Actually, to be more accurate it does this for every value in a column, and if it finds more values it considers "numeric" then it assumes the column has numeric values; otherwise it assumes text values.)

The columns you pointed out have an "R" character first and thus the sorting code assumes they are text.

I updated the template to do a slightly more thorough check.  Try this one.  In a future version of the software, I'll fix this by including type and actual value information in the export, so the sorting code won't have to guess.

rafatins

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: sort columns in stats export html
« Reply #4 on: January 30, 2014, 06:17:15 AM »
worked perfectly, just the column "tempo jogado (time played)" that did not work. But for me it is very good.