getExperimentR :: Text -> Handler Value
getExperimentR subjNumber = do
    mexp <- runDB $ do
        subj <- getBy $ UniqueSubject subjNumber
        case subj of
             Nothing -> return Nothing
             Just (Entity sid _) -> do
                 question <- getBy $ UniqueQuestions sid
                 rs <- selectList [ RatingSubject ==. sid ] [ ]
                 return $ Just (subj, question, rs)
    case mexp of
         Just (subj, question, rs) -> return $ object
            [ "subject" .= subj
            , "questions" .= question
            , "ratings" .= rs
            ]
         _ -> return $ object [ "msg" .= ("No subject" :: Text) ]
getExperimentR :: Text -> Handler Value
getExperimentR subjNumber = do
    mexp <- runDB $ do
        subj <- getBy $ UniqueSubject subjNumber
        case subj of
             Nothing -> return Nothing
             Just (Entity sid _) -> do
                 question <- getBy $ UniqueQuestions sid
                 rs <- selectList [ RatingSubject ==. sid ] [ ]
                 return $ Just (subj, question, rs)
    case mexp of
         Just (subj, question, rs) -> return $ object
            [ "subject" .= subj
            , "questions" .= question
            , "ratings" .= rs
            ]
         _ -> return $ object [ "msg" .= ("No subject" :: Text) ]
getExperimentR subjNumber = do
    mexp <- runDB $ do
        subj <- getBy $ UniqueSubject subjNumber
        case subj of
             Nothing -> return Nothing
             Just (Entity sid _) -> do
                 question <- getBy $ UniqueQuestions sid
                 rs <- selectList [ RatingSubject ==. sid ] [ ]
                 return $ Just (subj, question, rs)
    case mexp of
         Just (subj, question, rs) -> return $ object
            [ "subject" .= subj
            , "questions" .= question
            , "ratings" .= rs
            ]
         _ -> return $ object [ "msg" .= ("No subject" :: Text) ]