Fix #270
This commit is contained in:
parent
f5f9dea342
commit
38a35a673a
@ -21,6 +21,7 @@ import qualified Data.Map as Map
|
|||||||
|
|
||||||
import qualified Data.Text as Text
|
import qualified Data.Text as Text
|
||||||
import qualified Data.CaseInsensitive as CI
|
import qualified Data.CaseInsensitive as CI
|
||||||
|
import Data.CaseInsensitive (CI)
|
||||||
|
|
||||||
import Data.Semigroup (Sum(..))
|
import Data.Semigroup (Sum(..))
|
||||||
import Data.Monoid (All(..))
|
import Data.Monoid (All(..))
|
||||||
@ -281,6 +282,11 @@ makeCorrectionsTable whereClause dbtColonnade dbtFilterUI psValidator dbtProj' d
|
|||||||
| Set.null shns -> E.val True :: E.SqlExpr (E.Value Bool)
|
| Set.null shns -> E.val True :: E.SqlExpr (E.Value Bool)
|
||||||
| otherwise -> sheet E.^. SheetName `E.in_` E.valList (Set.toList shns)
|
| otherwise -> sheet E.^. SheetName `E.in_` E.valList (Set.toList shns)
|
||||||
)
|
)
|
||||||
|
, ( "sheet-search"
|
||||||
|
, FilterColumn $ \((_ `E.InnerJoin` sheet `E.InnerJoin` _) `E.LeftOuterJoin` _ :: CorrectionTableExpr) shns -> case getLast (shns :: Last (CI Text)) of
|
||||||
|
Nothing -> E.val True :: E.SqlExpr (E.Value Bool)
|
||||||
|
Just needle -> sheet E.^. SheetName `E.ilike` (E.%) E.++. E.val needle E.++. (E.%)
|
||||||
|
)
|
||||||
, ( "corrector"
|
, ( "corrector"
|
||||||
, FilterColumn $ \((_ `E.InnerJoin` _ `E.InnerJoin` _) `E.LeftOuterJoin` corrector :: CorrectionTableExpr) emails -> if
|
, FilterColumn $ \((_ `E.InnerJoin` _ `E.InnerJoin` _) `E.LeftOuterJoin` corrector :: CorrectionTableExpr) emails -> if
|
||||||
| Set.null emails -> E.val True :: E.SqlExpr (E.Value Bool)
|
| Set.null emails -> E.val True :: E.SqlExpr (E.Value Bool)
|
||||||
@ -495,11 +501,11 @@ postCorrectionsR = do
|
|||||||
, colRated
|
, colRated
|
||||||
] -- Continue here
|
] -- Continue here
|
||||||
filterUI = Just $ \mPrev -> mconcat
|
filterUI = Just $ \mPrev -> mconcat
|
||||||
[ Map.singleton "course" . maybeToList <$> aopt (lift `hoistField` selectField courseOptions) (fslI MsgCourse) (Just <$> listToMaybe =<< Map.lookup "course" =<< mPrev)
|
[ Map.singleton "course" . maybeToList <$> aopt (lift `hoistField` selectField courseOptions) (fslI MsgCourse) (Just <$> listToMaybe =<< Map.lookup "course" =<< mPrev)
|
||||||
, Map.singleton "term" . maybeToList <$> aopt (lift `hoistField` selectField termOptions) (fslI MsgTerm) (Just <$> listToMaybe =<< Map.lookup "term" =<< mPrev)
|
, Map.singleton "term" . maybeToList <$> aopt (lift `hoistField` selectField termOptions) (fslI MsgTerm) (Just <$> listToMaybe =<< Map.lookup "term" =<< mPrev)
|
||||||
, Map.singleton "school" . maybeToList <$> aopt (lift `hoistField` selectField schoolOptions) (fslI MsgCourseSchool) (Just <$> listToMaybe =<< Map.lookup "school" =<< mPrev)
|
, Map.singleton "school" . maybeToList <$> aopt (lift `hoistField` selectField schoolOptions) (fslI MsgCourseSchool) (Just <$> listToMaybe =<< Map.lookup "school" =<< mPrev)
|
||||||
|
, Map.singleton "sheet-search" . maybeToList <$> aopt (lift `hoistField` searchField False) (fslI MsgSheet) (Just <$> listToMaybe =<< Map.lookup "sheet-search" =<< mPrev)
|
||||||
, Map.singleton "israted" . fmap toPathPiece . maybeToList <$> aopt boolField (fslI MsgRatingTime) (Just <$> fromPathPiece =<< listToMaybe =<< Map.lookup "israted" =<< mPrev)
|
, Map.singleton "israted" . fmap toPathPiece . maybeToList <$> aopt boolField (fslI MsgRatingTime) (Just <$> fromPathPiece =<< listToMaybe =<< Map.lookup "israted" =<< mPrev)
|
||||||
]
|
]
|
||||||
courseOptions = runDB $ do
|
courseOptions = runDB $ do
|
||||||
courses <- selectList [] [Asc CourseShorthand] >>= filterM (\(Entity _ Course{..}) -> (== Authorized) <$> evalAccessCorrector courseTerm courseSchool courseShorthand)
|
courses <- selectList [] [Asc CourseShorthand] >>= filterM (\(Entity _ Course{..}) -> (== Authorized) <$> evalAccessCorrector courseTerm courseSchool courseShorthand)
|
||||||
|
|||||||
Reference in New Issue
Block a user