christianabila / climbinglogbookcsvreader

Reads the CSV file exported by the Climbing Logbook application
0 stars 0 forks source link

[FEATURE] log book entries assessment #14

Open christianabila opened 1 year ago

christianabila commented 1 year ago

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like The assessment should answer at least the following questions:

Number of ascents

Grades

Progress

Describe alternatives you've considered Evaluation via LibreOffice

Additional context n/a

christianabila commented 1 year ago

Number of ascents - SQL queries

-- Total number of ascents
SELECT COUNT(id)
   FROM entry
WHERE ascenttype <> "Project"

-- Total number of ascents per climb type
     SELECT climbtype, COUNT(id)
        FROM entry
     WHERE ascenttype <> "Project"
GROUP BY climbtype

-- Total number of ascents per ascent type
     SELECT ascenttype, COUNT(id)
        FROM entry
     WHERE ascenttype <> "Project"
GROUP BY ascenttype

-- Total number of ascents per climb type and ascent type
     SELECT climbtype, ascenttype, COUNT(id)
        FROM entry
     WHERE ascenttype <> "Project"
GROUP BY climbtype, ascenttype

-- Total number of ascents per grade
     SELECT climbtype, grade, COUNT(id)
        FROM entry
     WHERE ascenttype <> "Project"
GROUP BY climbtype, grade

-- Total number of ascents per grade type and ascent type
     SELECT climbtype, grade, ascenttype, COUNT(id)
        FROM entry
     WHERE ascenttype <> "Project"
GROUP BY climbtype, grade, ascenttype

-- Total number of ascents per wall type
     SELECT walltype, COUNT(id)
        FROM entry
     WHERE ascenttype <> "Project"
GROUP BY walltype

-- Total number of ascents per grade and wall type
     SELECT gradeindex, grade, walltype, COUNT(id)
        FROM entry
     WHERE ascenttype <> "Project"
GROUP BY gradeindex, grade, walltype
ORDER BY gradeindex DESC
christianabila commented 1 year ago

Grades - SQL queries

-- Highest grade climbed per climb type
  SELECT climbtype, MAX(grade)
    FROM entry
GROUP BY climbtype

-- Lowest grade climbed per climb type
  SELECT climbtype, MIN(grade)
    FROM entry
GROUP BY climbtype

-- Most sent grade by climb type
SELECT a.climbtype, b.grade, a.total
 FROM
(SELECT totalspergrade.climbtype, MAX(totalspergrade.totals) total
          FROM (SELECT climbtype, grade, COUNT(grade) totals
                  FROM entry
                 WHERE ascenttype <> "Project"
              GROUP BY climbtype, grade) totalspergrade
GROUP BY totalspergrade.climbtype) a
JOIN (SELECT climbtype, grade, COUNT(grade) totals
                  FROM entry
                 WHERE ascenttype <> "Project"
              GROUP BY climbtype, grade) b ON a.climbtype = b.climbtype AND a.total = b.totals
christianabila commented 1 year ago

Climbing enviroments

-- Climbs per environment (indoor vs. outdoor)
SELECT entry.climbtype, label.name, COUNT(entry.id)
  FROM  entry entry
  JOIN entrylabels el ON el.entryid = entry.id
  JOIN label label ON label.id = el.labelid AND label.name IN ("Indoors", "Outdoors")
WHERE entry.ascenttype <> "Project"
GROUP BY entry.climbtype, label.id

-- Climbs per indoor climbing gym
SELECT entry.climbtype, label.name, COUNT(entry.id)
  FROM  entry entry
  JOIN entrylabels el ON el.entryid = entry.id
  JOIN label label ON label.id = el.labelid AND label.name IN ("BB Wienerberg", "BB Seestadt", "Blockfabrik", "Klettercenter Rotpunkt", "Marswiese", "Kletterhalle Wien", "Kletterhalle Südstadt")
WHERE entry.ascenttype <> "Project"
GROUP BY entry.climbtype, label.id