• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Courseography / courseography / 91986145-cc23-45ad-b40f-6f7e0c8efd41

26 Jul 2026 10:21AM UTC coverage: 59.086% (+0.5%) from 58.617%
91986145-cc23-45ad-b40f-6f7e0c8efd41

Pull #1774

circleci

Purplegaze
initial solution, no tests yet
Pull Request #1774: Refactor hybrid text parsing to account for arbitrarily-nested ANDs and ORs

514 of 977 branches covered (52.61%)

Branch coverage included in aggregate %.

78 of 95 new or added lines in 2 files covered. (82.11%)

658 existing lines in 34 files now uncovered.

2422 of 3992 relevant lines covered (60.67%)

162.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

68.29
/app/DynamicGraphs/GraphOptions.hs
1
module DynamicGraphs.GraphOptions where
2

3
import Data.Aeson (FromJSON (parseJSON), withObject, (.!=), (.:?))
4
import qualified Data.Text.Lazy as T
5

6
data GraphOptions =
7
    GraphOptions { taken :: [T.Text],        -- courses to exclude from graph
63✔
8
                   departments :: [T.Text],  -- department prefixes to include
152✔
UNCOV
9
                   excludedDepth :: Int,     -- depth to recurse on courses from excluded departments
×
10
                   maxDepth :: Int,          -- total recursive depth to recurse on (depth of the overall graph)
×
11
                   courseNumPrefix :: [Int], -- filter based on course number (most useful for filtering based on year)
7✔
12
                   distribution :: [T.Text], -- distribution to include: like "artsci", or "engineering"
7✔
13
                   location :: [T.Text],     -- location of courses to include: like "utsg", or "utsc"
71✔
UNCOV
14
                   includeRaws :: Bool,      -- True to include nodes which are raw values
×
15
                   includeGrades :: Bool     -- True to include grade nodes
×
16
                } deriving (Show)
17

18
data CourseGraphOptions = CourseGraphOptions { courses :: [T.Text], programs :: [T.Text], graphOptions :: GraphOptions }
35✔
19
  deriving (Show)
20

21
defaultGraphOptions :: GraphOptions
22
defaultGraphOptions =
UNCOV
23
    GraphOptions []                    -- taken
×
UNCOV
24
                 []                    -- departments
×
25
                 0                     -- excludedDepth
×
26
                 (-1)                  -- maxDepth
×
27
                 []                    -- courseNumPrefix
×
28
                 []                    -- distribution
×
29
                 []                    -- location
×
30
                 True                  -- includeRaws
×
31
                 True                  -- includeGrades
×
32

33
instance FromJSON CourseGraphOptions where
34
  parseJSON = withObject "Expected Object for GraphOptions" $ \o -> do
7✔
35
    rootCourses <- o .:? "courses" .!= []
7✔
36
    rootPrograms <- o.:? "programs" .!= []
7✔
37
    takenCourses <- o .:? "taken" .!= []
7✔
38
    dept <- o .:? "departments" .!= []
7✔
39
    excludedCourseDepth <- o .:? "excludedDepth" .!= 0
7✔
40
    maxGraphDepth <- o .:? "maxDepth" .!= (-1)
7✔
41
    courseNumPref <- o .:? "courseNumPrefix" .!= []
7✔
42
    distrib <- o .:? "distribution" .!= []
7✔
43
    includedLocation <- o .:? "location" .!= []
7✔
44
    incRaws <- o .:? "includeRaws" .!= True
7✔
45
    incGrades <- o .:? "includeGrades" .!= True
7✔
46
    let options = GraphOptions takenCourses
7✔
47
                               dept
7✔
48
                               excludedCourseDepth
7✔
49
                               maxGraphDepth
7✔
50
                               courseNumPref
7✔
51
                               distrib
7✔
52
                               includedLocation
7✔
53
                               incRaws
7✔
54
                               incGrades
7✔
55
    return $ CourseGraphOptions rootCourses rootPrograms options
7✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc