Advertisement
Guest User

gc-golf-export.jq

a guest
Mar 20th, 2021
1,267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. # v3 (2021-03-20)
  2.  
  3. # CSV Header
  4. [
  5. "Start Time",
  6. "Start Time (UTC)",
  7. "Scorecard URL",
  8. "Course",
  9. "Score",
  10. "Handicap",
  11. "Strokes",
  12. "Handicapped Strokes",
  13.  
  14. ([range(1;19)] | map(tostring |
  15. "Hole \(.) - Time (UTC)",
  16. "Hole \(.) - Par",
  17. "Hole \(.) - Strokes",
  18. "Hole \(.) - Handicap Score",
  19. "Hole \(.) - Lat",
  20. "Hole \(.) - Lon"
  21. ) | .[])
  22. ],
  23.  
  24. # CSV Data
  25. (
  26. .details[] |
  27. .scorecardDetails[0].scorecard as $scorecard |
  28. .courseSnapshots[0] as $course |
  29. [
  30. $scorecard.formattedStartTime,
  31. $scorecard.startTime,
  32. .scorecardURL,
  33. $course.name,
  34. $scorecard.score,
  35. $scorecard.playerHandicap,
  36. $scorecard.strokes,
  37. $scorecard.handicappedStrokes,
  38.  
  39. ($scorecard.holes | map(
  40. .lastModifiedDt,
  41. $course.holePars[.number-1:.number],
  42. .strokes,
  43. .handicapScore,
  44. .pinPositionLat,
  45. .pinPositionLon
  46. ) | .[])
  47. ]
  48. )
  49.  
  50. | @csv
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement