<commit_before>{-# LANGUAGE OverloadedStrings #-}
module Bead.View.Snap.Content.CourseOverview (
    courseOverview
  ) where

import           Data.String (fromString)
import           Data.Time (UTCTime, getCurrentTime)

import qualified Text.Blaze.Html5 as H

import qualified Bead.Controller.UserStories as Story
import           Bead.View.Snap.Content
import           Bead.View.Snap.RequestParams
import           Bead.View.Snap.Content.SubmissionTable

data PageData
  = CourseSubmissions UTCTime SubmissionTableContext SubmissionTableInfo

pageDataCata
  courseSubmissions
  p = case p of
    CourseSubmissions now stc sti -> courseSubmissions now stc sti

courseOverview :: Content
courseOverview = getContentHandler courseSubmissionsPage

courseSubmissionsPage :: GETContentHandler
courseSubmissionsPage = withUserState $ \s -> do
  ck <- getParameter (customCourseKeyPrm courseKeyParamName)
  now <- liftIO $ getCurrentTime
  (stc,sti) <- userStory $ do
    stc <- submissionTableContext
    sti <- Story.courseSubmissionTable ck
    return (stc, sti)
  renderPagelet . withUserFrame s . content $ CourseSubmissions now stc sti

content :: PageData -> IHtml
content = pageDataCata courseSubmissionsContent

courseSubmissionsContent :: UTCTime -> SubmissionTableContext -> SubmissionTableInfo -> IHtml
courseSubmissionsContent now c s = do
  msg <- getI18N
  return $ do
    H.p $ fromString . msg $ Msg_Home_SubmissionTable_Info $ concat
      [ "Assignments may be modified by clicking on their identifiers if you have rights for the modification (their names are shown in the tooltip).  "
      , "Students may be unregistered from the courses or the groups by checking the boxes in the Remove column "
      , "then clicking on the button."<commit_msg>Course Overview: Sorting user lines<commit_after>{-# LANGUAGE OverloadedStrings #-}
module Bead.View.Snap.Content.CourseOverview (
    courseOverview
  ) where

import           Data.String (fromString)
import           Data.Time (UTCTime, getCurrentTime)

import qualified Text.Blaze.Html5 as H

import qualified Bead.Controller.UserStories as Story
import           Bead.View.Snap.Content
import           Bead.View.Snap.RequestParams
import           Bead.View.Snap.Content.SubmissionTable

data PageData
  = CourseSubmissions UTCTime SubmissionTableContext SubmissionTableInfo

pageDataCata
  courseSubmissions
  p = case p of
    CourseSubmissions now stc sti -> courseSubmissions now stc sti

courseOverview :: Content
courseOverview = getContentHandler courseSubmissionsPage

courseSubmissionsPage :: GETContentHandler
courseSubmissionsPage = withUserState $ \s -> do
  ck <- getParameter (customCourseKeyPrm courseKeyParamName)
  now <- liftIO $ getCurrentTime
  (stc,sti) <- userStory $ do
    stc <- submissionTableContext
    sti <- sortUserLines <$> Story.courseSubmissionTable ck
    return (stc, sti)
  renderPagelet . withUserFrame s . content $ CourseSubmissions now stc sti

content :: PageData -> IHtml
content = pageDataCata courseSubmissionsContent

courseSubmissionsContent :: UTCTime -> SubmissionTableContext -> SubmissionTableInfo -> IHtml
courseSubmissionsContent now c s = do
  msg <- getI18N
  return $ do
    H.p $ fromString . msg $ Msg_Home_SubmissionTable_Info $ concat
      [ "Assignments may be modified by clicking on their identifiers if you have rights for the modification (their names are shown in the tooltip).  "
      , "Students may be unregistered from the courses or the groups by checking the boxes in the Remove column "
      , "then clicking on the button."
{'fraction_non_alphanumeric': 0.06215005599104143, 'fraction_numerical': 0.0016797312430011197, 'mean_word_length': 3.887824897400821, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3944612', 'n_tokens_mistral': 1053, 'n_tokens_neox': 982, 'n_words': 320}