diff --git a/tests/syntax_tests/data/idempotency/nook-exchange/UserStore.res b/tests/syntax_tests/data/idempotency/nook-exchange/UserStore.res
index 890bc931e8..11632eb610 100644
--- a/tests/syntax_tests/data/idempotency/nook-exchange/UserStore.res
+++ b/tests/syntax_tests/data/idempotency/nook-exchange/UserStore.res
@@ -13,13 +13,13 @@ type action =
| FollowUser(string)
| UnfollowUser(string)
-let sessionId = ref(Dom.Storage.localStorage |> Dom.Storage.getItem("sessionId"))
+let sessionId = ref(Dom.Storage.localStorage->Dom.Storage.getItem("sessionId"))
let updateSessionId = newValue => {
sessionId := newValue
open Dom.Storage
switch newValue {
- | Some(sessionId) => localStorage |> setItem("sessionId", sessionId)
- | None => localStorage |> removeItem("sessionId")
+ | Some(sessionId) => localStorage->setItem("sessionId", sessionId)
+ | None => localStorage->removeItem("sessionId")
}
}
@@ -187,7 +187,7 @@ let setItemStatus = (~itemId: int, ~variation: int, ~status: User.itemStatus) =>
)
handleServerResponse("/@me/items/status", responseResult)
Promise.resolved()
- }) |> ignore
+ })->ignore
if numItemUpdatesLogged.contents < 2 || updatedUser.items->Js.Dict.keys->Js.Array.length < 4 {
Analytics.Amplitude.logEventWithProperties(
~eventName="Item Status Updated",
@@ -208,7 +208,7 @@ let setItemStatusBatch = (~items: array<(int, int)>, ~status) => {
...user,
items: {
let clone = Utils.cloneJsDict(user.items)
- items |> Js.Array.forEach(((itemId, variant)) => {
+ items->Js.Array.forEach(((itemId, variant)) => {
let itemKey = User.getItemKey(~itemId, ~variation=variant)
clone->Js.Dict.set(
itemKey,
@@ -242,7 +242,7 @@ let setItemStatusBatch = (~items: array<(int, int)>, ~status) => {
},
)
Promise.resolved()
- }) |> ignore
+ })->ignore
Analytics.Amplitude.setItemCount(~itemCount=Js.Dict.keys(updatedUser.items)->Js.Array.length)
}
@@ -277,7 +277,7 @@ let setItemNote = (~itemId: int, ~variation: int, ~note: string) => {
)
handleServerResponse("/@me/items/note", responseResult)
Promise.resolved()
- }) |> ignore
+ })->ignore
if numItemUpdatesLogged.contents < 2 || updatedUser.items->Js.Dict.keys->Js.Array.length < 4 {
Analytics.Amplitude.logEventWithProperties(
~eventName="Item Note Updated",
@@ -318,7 +318,7 @@ let setItemPriority = (~itemId: int, ~variant: int, ~isPriority: bool) => {
)
handleServerResponse("/@me/items/priority", responseResult)
Promise.resolved()
- }) |> ignore
+ })->ignore
if !didLogItemPriority.contents {
Analytics.Amplitude.logEventWithProperties(
~eventName="Item Priority Updated",
@@ -363,7 +363,7 @@ let removeItem = (~itemId, ~variation) => {
)
handleServerResponse("/@me/items/remove", responseResult)
Promise.resolved()
- }) |> ignore
+ })->ignore
Analytics.Amplitude.setItemCount(~itemCount=Js.Dict.keys(updatedUser.items)->Js.Array.length)
}
}
@@ -374,7 +374,7 @@ let removeItems = (~items: array<(int, int)>) => {
...user,
items: {
let clone = Utils.cloneJsDict(user.items)
- items |> Js.Array.forEach(((itemId, variant)) => {
+ items->Js.Array.forEach(((itemId, variant)) => {
let key = User.getItemKey(~itemId, ~variation=variant)
Utils.deleteJsDictKey(clone, key)
})
@@ -390,7 +390,7 @@ let removeItems = (~items: array<(int, int)>) => {
~eventProperties={"numItems": Js.Array.length(items)},
)
Promise.resolved()
- }) |> ignore
+ })->ignore
Analytics.Amplitude.setItemCount(~itemCount=Js.Dict.keys(updatedUser.items)->Js.Array.length)
}
@@ -406,7 +406,7 @@ let updateProfileText = (~profileText) => {
)
handleServerResponse("/@me/profileText", responseResult)
Promise.resolved()
- }) |> ignore
+ })->ignore
Analytics.Amplitude.logEventWithProperties(
~eventName="Profile Text Updated",
~eventProperties={"text": profileText},
@@ -470,7 +470,7 @@ let toggleCatalogCheckboxSetting = (~enabled) => {
)
handleServerResponse("/@me/toggleCatalogCheckboxSetting", responseResult)
Promise.resolved()
- }) |> ignore
+ })->ignore
Analytics.Amplitude.logEventWithProperties(
~eventName="Catalog Checkbox Setting Toggled",
~eventProperties={"enabled": enabled},
@@ -506,7 +506,7 @@ let register = (~username, ~email, ~password) =>
%Repromise.JsExn({
let json = Fetch.Response.json(response)
updateSessionId(
- json |> {
+ json->{
open Json.Decode
optional(field("sessionId", string))
},
@@ -520,7 +520,7 @@ let register = (~username, ~email, ~password) =>
} else {
%Repromise.JsExn({
let text = Fetch.Response.text(response)
- let result = text |> Js.Re.exec_(errorQuotationMarksRegex)
+ let result = text->Js.Re.exec_(errorQuotationMarksRegex)
let text = switch result {
| Some(match_) =>
let captures = Js.Re.captures(match_)
@@ -559,7 +559,7 @@ let loginWithDiscord = (~code, ~isRegister) =>
%Repromise.JsExn({
let json = Fetch.Response.json(response)
updateSessionId(
- json |> {
+ json->{
open Json.Decode
optional(field("sessionId", string))
},
@@ -572,7 +572,7 @@ let loginWithDiscord = (~code, ~isRegister) =>
~email=user.email->Belt.Option.getWithDefault(""),
)
let isRegister =
- (json |> {
+ (json->{
open Json.Decode
optional(field("isRegister", bool))
})->Belt.Option.getWithDefault(false)
@@ -591,7 +591,7 @@ let loginWithDiscord = (~code, ~isRegister) =>
} else {
%Repromise.JsExn({
let text = Fetch.Response.text(response)
- let result = text |> Js.Re.exec_(errorQuotationMarksRegex)
+ let result = text->Js.Re.exec_(errorQuotationMarksRegex)
let text = switch result {
| Some(match_) =>
let captures = Js.Re.captures(match_)
@@ -652,7 +652,7 @@ let login = (~username, ~password) =>
%Repromise.JsExn({
let json = Fetch.Response.json(response)
updateSessionId(
- json |> {
+ json->{
open Json.Decode
optional(field("sessionId", string))
},
@@ -669,7 +669,7 @@ let login = (~username, ~password) =>
let logout = () => {
api.dispatch(Logout)
- Dom.Storage.localStorage |> Dom.Storage.removeItem("sessionId")
+ Dom.Storage.localStorage->Dom.Storage.removeItem("sessionId")
Analytics.Amplitude.setUserId(~userId=None)
ReasonReactRouter.push("/")
let sessionId = sessionId.contents
@@ -720,7 +720,7 @@ let deleteAccount = () => {
| Ok(response) =>
if Fetch.Response.status(response) < 300 {
api.dispatch(Logout)
- Dom.Storage.localStorage |> Dom.Storage.removeItem("sessionId")
+ Dom.Storage.localStorage->Dom.Storage.removeItem("sessionId")
Analytics.Amplitude.setUserId(~userId=None)
ReasonReactRouter.push("/")
updateSessionId(None)
@@ -740,7 +740,7 @@ let connectDiscordAccount = (~code) => {
)
%Repromise.JsExn({
let json = Fetch.Response.json(response)
- let discordId = json |> {
+ let discordId = json->{
open Json.Decode
field("discordId", string)
}
@@ -748,7 +748,7 @@ let connectDiscordAccount = (~code) => {
ReasonReactRouter.push("/settings")
Promise.resolved()
})
- }) |> ignore
+ })->ignore
// TODO: error
let processNotLoggedIn = () => ()
switch api.getState() {
@@ -790,7 +790,7 @@ let init = () =>
if Fetch.Response.status(response) < 400 {
%Repromise.JsExn({
let json = Fetch.Response.json(response)
- switch json |> {
+ switch json->{
open Json.Decode
optional(field("sessionId", string))
} {
@@ -806,6 +806,6 @@ let init = () =>
api.dispatch(FetchMeFailed)
Promise.resolved()
}
- }) |> ignore
+ })->ignore
| None => ()
}
diff --git a/tests/syntax_tests/data/idempotency/nook-exchange/UserViewingPage.res b/tests/syntax_tests/data/idempotency/nook-exchange/UserViewingPage.res
index c9c4fe961c..4f13c4842c 100644
--- a/tests/syntax_tests/data/idempotency/nook-exchange/UserViewingPage.res
+++ b/tests/syntax_tests/data/idempotency/nook-exchange/UserViewingPage.res
@@ -94,7 +94,7 @@ module FollowLink = {
)
}
Promise.resolved()
- }) |> ignore
+ })->ignore
} else {
showLogin()
}
@@ -130,7 +130,7 @@ let make = (~username, ~urlRest, ~url: ReasonReactRouter.url, ~showLogin) => {
switch (me, user) {
| (Some(me), Some(user: User.t)) =>
switch me.followeeIds {
- | Some(followeeIds) => followeeIds |> Js.Array.includes(user.id)
+ | Some(followeeIds) => followeeIds->Js.Array.includes(user.id)
| None => false
}
| _ => false
@@ -138,7 +138,7 @@ let make = (~username, ~urlRest, ~url: ReasonReactRouter.url, ~showLogin) => {
, (isLoggedIn, user))
React.useEffect0(() => {
open Webapi.Dom
- window |> Window.scrollTo(0., 0.)
+ window->Window.scrollTo(0., 0.)
Some(() => React.Ref.setCurrent(isMountedRef, false))
})
React.useEffect1(() => {
@@ -163,7 +163,7 @@ let make = (~username, ~urlRest, ~url: ReasonReactRouter.url, ~showLogin) => {
})
| _ => Promise.resolved()
}
- }) |> ignore
+ })->ignore
None
}, [username])
React.useEffect0(() => {
diff --git a/tests/syntax_tests/data/idempotency/nook-exchange/Utils.res b/tests/syntax_tests/data/idempotency/nook-exchange/Utils.res
index 679cf60f21..f178340cdf 100644
--- a/tests/syntax_tests/data/idempotency/nook-exchange/Utils.res
+++ b/tests/syntax_tests/data/idempotency/nook-exchange/Utils.res
@@ -28,7 +28,7 @@ let getElementForDomRef = domRef =>
domRef->React.Ref.current->Js.Nullable.toOption->Belt.Option.getExn
let capitalizeFirstLetter = input =>
- Js.String.toUpperCase(Js.String.charAt(0, input)) ++ (input |> Js.String.sliceToEnd(~from=1))
+ Js.String.toUpperCase(Js.String.charAt(0, input)) ++ (input->Js.String.sliceToEnd(~from=1))
let throttle = (fn, ms) => {
let timeoutRef = ref(None)
@@ -47,14 +47,14 @@ let throttle = (fn, ms) => {
let useViewportWidth = () => {
let (viewportWidth, setViewportWidth) = React.useState(() => {
open Webapi.Dom
- window |> Window.innerWidth
+ window->Window.innerWidth
})
React.useEffect0(() => {
open Webapi.Dom
- let onResize = _ => setViewportWidth(_ => window |> Window.innerWidth)
+ let onResize = _ => setViewportWidth(_ => window->Window.innerWidth)
let onResize = throttle(onResize, 300)
- window |> Window.addEventListener("resize", onResize)
- Some(() => window |> Window.removeEventListener("resize", onResize))
+ window->Window.addEventListener("resize", onResize)
+ Some(() => window->Window.removeEventListener("resize", onResize))
})
viewportWidth
}
@@ -63,15 +63,15 @@ let useViewportWidth = () => {
external mediaQueryListMatches: Webapi.Dom.Window.mediaQueryList => bool = "matches"
let browserSupportsHover = {
open Webapi.Dom
- window |> Window.matchMedia("(hover: hover)")
+ window->Window.matchMedia("(hover: hover)")
}->mediaQueryListMatches
let getPath = (~url: ReasonReactRouter.url) =>
- "/" ++ (Belt.List.toArray(url.path) |> Js.Array.joinWith("/"))
+ "/" ++ (Belt.List.toArray(url.path)->Js.Array.joinWith("/"))
let getPathWithSearch = (~url: ReasonReactRouter.url) =>
"/" ++
- ((Belt.List.toArray(url.path) |> Js.Array.joinWith("/")) ++
+ ((Belt.List.toArray(url.path)->Js.Array.joinWith("/")) ++
switch url.search {
| "" => ""
| search => "?" ++ search
diff --git a/tests/syntax_tests/data/idempotency/nook-exchange/WishlistToCatalog.res b/tests/syntax_tests/data/idempotency/nook-exchange/WishlistToCatalog.res
index b634b8c013..5ab170ccc8 100644
--- a/tests/syntax_tests/data/idempotency/nook-exchange/WishlistToCatalog.res
+++ b/tests/syntax_tests/data/idempotency/nook-exchange/WishlistToCatalog.res
@@ -1,10 +1,10 @@
module PersistConfig = {
let key = "confirm_wishlist_to_catalog"
- let value = ref(Dom.Storage.localStorage |> Dom.Storage.getItem(key))
+ let value = ref(Dom.Storage.localStorage->Dom.Storage.getItem(key))
let confirm = () => {
let nowString = Js.Date.now()->Js.Float.toString
value := Some(nowString)
- Dom.Storage.localStorage |> Dom.Storage.setItem(key, nowString)
+ Dom.Storage.localStorage->Dom.Storage.setItem(key, nowString)
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesApply__Form.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesApply__Form.res
index 8a3f8c35cb..89b461aaff 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesApply__Form.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesApply__Form.res
@@ -9,19 +9,19 @@ module CreateApplicantQuery = %graphql(`
`)
let createApplicant = (courseId, email, name, setSaving, setViewEmailSent, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
setSaving(_ => true)
CreateApplicantQuery.make(~courseId, ~email, ~name, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
response["createApplicant"]["success"] ? setViewEmailSent() : setSaving(_ => false)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
-let isInvalidEmail = email => email |> EmailUtils.isInvalid(false)
+let isInvalidEmail = email => email->EmailUtils.isInvalid(false)
let saveDisabled = (email, name, saving) => isInvalidEmail(email) || (saving || name == "")
let buttonText = (email, name, saving) =>
@@ -35,15 +35,15 @@ let buttonText = (email, name, saving) =>
@react.component
let make = (~courseName, ~courseId, ~setViewEmailSent, ~email, ~name) => {
- let (email, setEmail) = React.useState(() => email |> OptionUtils.default(""))
- let (name, setName) = React.useState(() => name |> OptionUtils.default(""))
+ let (email, setEmail) = React.useState(() => email->OptionUtils.default(""))
+ let (name, setName) = React.useState(() => name->OptionUtils.default(""))
let (saving, setSaving) = React.useState(() => false)
-
{"Enroll to " ++ (courseName ++ " course") |> str}
+
{"Enroll to " ++ (courseName ++ " course")->str}
{
{
onClick={createApplicant(courseId, email, name, setSaving, setViewEmailSent)}
className="btn btn-primary btn-large text-center w-full mt-6">
{saving ? : ReasonReact.null}
- {buttonText(email, name, saving) |> str}
+ {buttonText(email, name, saving)->str}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesApply__Root.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesApply__Root.res
index 6ae53cda6d..89eba610e6 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesApply__Root.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesApply__Root.res
@@ -16,10 +16,10 @@ let emailSentMessage = () =>
- {"We've sent you a verification mail." |> str}
+ {"We've sent you a verification mail."->str}
- {"It should reach you in less than a minute. Click the link in the email to sign up, and get started." |> str}
+ {"It should reach you in less than a minute. Click the link in the email to sign up, and get started."->str}
@@ -60,7 +60,7 @@ let make = (~courseName, ~courseId, ~thumbnailUrl, ~email, ~name, ~privacyPolicy
?
- {"Terms of Use" |> str}
+ {"Terms of Use"->str}
: React.null}
{termsOfUse && privacyPolicy
@@ -70,7 +70,7 @@ let make = (~courseName, ~courseId, ~thumbnailUrl, ~email, ~name, ~privacyPolicy
?
- {"Privacy Policy" |> str}
+ {"Privacy Policy"->str}
: React.null}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum.res
index d448721e49..b78b5e480b 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum.res
@@ -18,15 +18,15 @@ type state = {
let targetStatusClasses = targetStatus => {
let statusClasses =
"curriculum__target-status--" ++
- (targetStatus |> TargetStatus.statusToString |> Js.String.toLowerCase)
+ (targetStatus->TargetStatus.statusToString->Js.String.toLowerCase)
"curriculum__target-status px-3 py-px ml-4 h-6 " ++ statusClasses
}
let rendertarget = (target, statusOfTargets) => {
- let targetId = target |> Target.id
+ let targetId = target->Target.id
let targetStatus =
- statusOfTargets |> ListUtils.unsafeFind(
- ts => ts |> TargetStatus.targetId == targetId,
+ statusOfTargets->ListUtils.unsafeFind(
+ ts => ts->TargetStatus.targetId == targetId,
"Could not find targetStatus for listed target with ID " ++ targetId,
)
@@ -35,41 +35,41 @@ let rendertarget = (target, statusOfTargets) => {
key={"target-" ++ targetId}
className="bg-white border-t p-6 flex items-center justify-between hover:bg-gray-200 hover:text-primary-500 cursor-pointer"
ariaLabel={"Select Target " ++ targetId}>
-
{target |> Target.title |> str}
+
{target->Target.title->str}
- {targetStatus |> TargetStatus.statusToString |> str}
+ {targetStatus->TargetStatus.statusToString->str}
}
let renderTargetGroup = (targetGroup, targets, statusOfTargets) => {
- let targetGroupId = targetGroup |> TargetGroup.id
- let targets = targets |> List.filter(t => t |> Target.targetGroupId == targetGroupId)
+ let targetGroupId = targetGroup->TargetGroup.id
+ let targets = targets->List.filter(t => t->Target.targetGroupId == targetGroupId)
- {targetGroup |> TargetGroup.milestone
+ {targetGroup->TargetGroup.milestone
?
- {"Milestone targets" |> str}
+ {"Milestone targets"->str}
: React.null}
- {targetGroup |> TargetGroup.name |> str}
+ {targetGroup->TargetGroup.name->str}
- {targetGroup |> TargetGroup.description |> str}
+ {targetGroup->TargetGroup.description->str}
{targets
- |> List.sort((t1, t2) => (t1 |> Target.sortIndex) - (t2 |> Target.sortIndex))
- |> List.map(target => rendertarget(target, statusOfTargets))
- |> Array.of_list
- |> React.array}
+ ->List.sort((t1, t2) => (t1->Target.sortIndex) - (t2->Target.sortIndex))
+ ->List.map(target => rendertarget(target, statusOfTargets))
+ ->Array.of_list
+ ->React.array}
}
@@ -77,8 +77,8 @@ let renderTargetGroup = (targetGroup, targets, statusOfTargets) => {
let addSubmission = (setState, latestSubmission) =>
setState(state => {
let withoutSubmissionForThisTarget =
- state.latestSubmissions |> List.filter(s =>
- s |> LatestSubmission.targetId != (latestSubmission |> LatestSubmission.targetId)
+ state.latestSubmissions->List.filter(s =>
+ s->LatestSubmission.targetId != (latestSubmission->LatestSubmission.targetId)
)
{
@@ -89,14 +89,14 @@ let addSubmission = (setState, latestSubmission) =>
let handleLockedLevel = level =>
-
{"Level Locked" |> str}
+
{"Level Locked"->str}

- {switch level |> Level.unlockOn {
+ {switch level->Level.unlockOn {
| Some(date) =>
- let dateString = date |> DateFns.parseString |> DateFns.format("MMMM D, YYYY")
+ let dateString = date->DateFns.parseString->DateFns.format("MMMM D, YYYY")
-
{"The level is currently locked!" |> str}
-
{"You can access the content on " ++ (dateString ++ ".") |> str}
+
{"The level is currently locked!"->str}
+
{"You can access the content on " ++ (dateString ++ ".")->str}
| None => React.null
}}
@@ -104,23 +104,23 @@ let handleLockedLevel = level =>
let statusOfMilestoneTargets = (targetGroups, targets, level, statusOfTargets) => {
let targetGroupsInLevel =
- targetGroups |> List.filter(tg => tg |> TargetGroup.levelId == (level |> Level.id))
+ targetGroups->List.filter(tg => tg->TargetGroup.levelId == (level->Level.id))
let milestoneTargetGroupIds =
targetGroupsInLevel
- |> List.filter(tg => tg |> TargetGroup.milestone)
- |> List.map(tg => tg |> TargetGroup.id)
+ ->List.filter(tg => tg->TargetGroup.milestone)
+ ->List.map(tg => tg->TargetGroup.id)
let milestoneTargetIds =
targets
- |> List.filter(t => (t |> Target.targetGroupId)->List.mem(milestoneTargetGroupIds))
- |> List.map(t => t |> Target.id)
+ ->List.filter(t => (t->Target.targetGroupId)->List.mem(milestoneTargetGroupIds))
+ ->List.map(t => t->Target.id)
- statusOfTargets |> List.filter(ts => (ts |> TargetStatus.targetId)->List.mem(milestoneTargetIds))
+ statusOfTargets->List.filter(ts => (ts->TargetStatus.targetId)->List.mem(milestoneTargetIds))
}
let isLevelComplete = (targetStatuses, eligibleStatuses) =>
- targetStatuses |> ListUtils.isNotEmpty &&
- targetStatuses |> TargetStatus.matchesStatuses(eligibleStatuses)
+ targetStatuses->ListUtils.isNotEmpty &&
+ targetStatuses->TargetStatus.matchesStatuses(eligibleStatuses)
let computeLevelUp = (
levels,
@@ -130,11 +130,11 @@ let computeLevelUp = (
statusOfTargets,
accessLockedLevels,
) => {
- let lastLevel = switch teamLevel |> Level.number {
+ let lastLevel = switch teamLevel->Level.number {
| 0
| 1 =>
None
- | levelTwoOrAbove => levels |> ListUtils.findOpt(l => l |> Level.number == levelTwoOrAbove - 1)
+ | levelTwoOrAbove => levels->ListUtils.findOpt(l => l->Level.number == levelTwoOrAbove - 1)
}
let statusOfCurrentMilestoneTargets = statusOfMilestoneTargets(
@@ -163,13 +163,13 @@ let computeLevelUp = (
}
let nextLevel =
- levels |> ListUtils.findOpt(l => l |> Level.number == (teamLevel |> Level.number) + 1)
+ levels->ListUtils.findOpt(l => l->Level.number == (teamLevel->Level.number) + 1)
switch (nextLevel, currentLevelComplete, lastLevelComplete) {
| (Some(level), true, true) =>
- level |> Level.isUnlocked || accessLockedLevels ? Notice.LevelUp : Nothing
+ level->Level.isUnlocked || accessLockedLevels ? Notice.LevelUp : Nothing
| (None, true, true) => CourseComplete
- | (Some(_), true, false) => LevelUpBlocked(teamLevel |> Level.number)
+ | (Some(_), true, false) => LevelUpBlocked(teamLevel->Level.number)
| (Some(_) | None, false, false | true)
| (None, true, false) =>
Nothing
@@ -187,7 +187,7 @@ let computeNotice = (
preview,
accessLockedLevels,
) =>
- switch (preview, course |> Course.hasEnded, team |> Team.accessEnded) {
+ switch (preview, course->Course.hasEnded, team->Team.accessEnded) {
| (true, _, _) => Notice.Preview
| (false, true, true | false) => CourseEnded
| (false, false, true) => AccessEnded
@@ -205,18 +205,18 @@ let navigationLink = (direction, level, setState) => {
icon->Belt.Option.mapWithDefault(React.null, icon =>
)
}
let quickNavigationLinks = (levels, selectedLevel, setState) => {
- let previous = selectedLevel |> Level.previous(levels)
- let next = selectedLevel |> Level.next(levels)
+ let previous = selectedLevel->Level.previous(levels)
+ let next = selectedLevel->Level.next(levels)
@@ -230,7 +230,7 @@ let quickNavigationLinks = (levels, selectedLevel, setState) => {
{navigationLink(#Next, nextLevel, setState)}
,
- ] |> React.array
+ ]->React.array
| (Some(previousUrl), None) =>
{navigationLink(#Previous, previousUrl, setState)}
@@ -261,8 +261,8 @@ let make = (
let selectedTarget = switch url.path {
| list{"targets", targetId, ..._} =>
Some(
- targets |> ListUtils.unsafeFind(
- t => t |> Target.id == targetId,
+ targets->ListUtils.unsafeFind(
+ t => t->Target.id == targetId,
"Could not find selectedTarget with ID " ++ targetId,
),
)
@@ -277,26 +277,26 @@ let make = (
* used to determine currentLevelId, which is the actual level whose contents
* are shown on the page. */
- let levelZero = levels |> ListUtils.findOpt(l => l |> Level.number == 0)
- let teamLevelId = team |> Team.levelId
+ let levelZero = levels->ListUtils.findOpt(l => l->Level.number == 0)
+ let teamLevelId = team->Team.levelId
let teamLevel =
- levels |> ListUtils.unsafeFind(
- l => l |> Level.id == teamLevelId,
+ levels->ListUtils.unsafeFind(
+ l => l->Level.id == teamLevelId,
"Could not find teamLevel with ID " ++ teamLevelId,
)
let targetLevelId = switch selectedTarget {
| Some(target) =>
- let targetGroupId = target |> Target.targetGroupId
+ let targetGroupId = target->Target.targetGroupId
let targetGroup =
- targetGroups |> ListUtils.unsafeFind(
- t => t |> TargetGroup.id == targetGroupId,
+ targetGroups->ListUtils.unsafeFind(
+ t => t->TargetGroup.id == targetGroupId,
"Could not find targetGroup with ID " ++ targetGroupId,
)
- Some(targetGroup |> TargetGroup.levelId)
+ Some(targetGroup->TargetGroup.levelId)
| None => None
}
@@ -317,14 +317,14 @@ let make = (
{
selectedLevelId: switch (preview, targetLevelId, levelZero) {
- | (true, None, None) => levels |> Level.first |> Level.id
+ | (true, None, None) => levels->Level.first->Level.id
| (_, Some(targetLevelId), Some(levelZero)) =>
- levelZero |> Level.id == targetLevelId ? teamLevelId : targetLevelId
+ levelZero->Level.id == targetLevelId ? teamLevelId : targetLevelId
| (_, Some(targetLevelId), None) => targetLevelId
| (_, None, _) => teamLevelId
},
showLevelZero: switch (levelZero, targetLevelId) {
- | (Some(levelZero), Some(targetLevelId)) => levelZero |> Level.id == targetLevelId
+ | (Some(levelZero), Some(targetLevelId)) => levelZero->Level.id == targetLevelId
| (Some(_), None)
| (None, Some(_))
| (None, None) => false
@@ -346,26 +346,26 @@ let make = (
})
let currentLevelId = switch (levelZero, state.showLevelZero) {
- | (Some(levelZero), true) => levelZero |> Level.id
+ | (Some(levelZero), true) => levelZero->Level.id
| (Some(_), false)
| (None, true | false) =>
state.selectedLevelId
}
let currentLevel =
- levels |> ListUtils.unsafeFind(
- l => l |> Level.id == currentLevelId,
+ levels->ListUtils.unsafeFind(
+ l => l->Level.id == currentLevelId,
"Could not find currentLevel with id " ++ currentLevelId,
)
let selectedLevel =
- levels |> ListUtils.unsafeFind(
- l => l |> Level.id == state.selectedLevelId,
+ levels->ListUtils.unsafeFind(
+ l => l->Level.id == state.selectedLevelId,
"Could not find selectedLevel with id " ++ state.selectedLevelId,
)
React.useEffect1(() => {
- if initialRender |> React.Ref.current {
+ if initialRender->React.Ref.current {
initialRender->React.Ref.setCurrent(false)
} else {
let newStatusOfTargets = computeTargetStatus(state.latestSubmissions)
@@ -390,15 +390,15 @@ let make = (
}, [state.latestSubmissions])
let targetGroupsInLevel =
- targetGroups |> List.filter(tg => tg |> TargetGroup.levelId == currentLevelId)
+ targetGroups->List.filter(tg => tg->TargetGroup.levelId == currentLevelId)
{switch selectedTarget {
| Some(target) =>
let targetStatus =
- state.statusOfTargets |> ListUtils.unsafeFind(
- ts => ts |> TargetStatus.targetId == (target |> Target.id),
- "Could not find targetStatus for selectedTarget with ID " ++ (target |> Target.id),
+ state.statusOfTargets->ListUtils.unsafeFind(
+ ts => ts->TargetStatus.targetId == (target->Target.id),
+ "Could not find targetStatus for selectedTarget with ID " ++ (target->Target.id),
)
{...state, showLevelZero: showLevelZero})}
levelZero
/>
- {currentLevel |> Level.isLocked && accessLockedLevels
+ {currentLevel->Level.isLocked && accessLockedLevels
?
- {"This level is still locked for students, and will be unlocked on " |> str}
- {currentLevel |> Level.unlockDateString |> str}
- {"." |> str}
+ {"This level is still locked for students, and will be unlocked on "->str}
+ {currentLevel->Level.unlockDateString->str}
+ {"."->str}
: React.null}
- {currentLevel |> Level.isUnlocked || accessLockedLevels
+ {currentLevel->Level.isUnlocked || accessLockedLevels
? targetGroupsInLevel
- |> TargetGroup.sort
- |> List.map(targetGroup =>
+ ->TargetGroup.sort
+ ->List.map(targetGroup =>
renderTargetGroup(targetGroup, targets, state.statusOfTargets)
)
- |> Array.of_list
- |> React.array
+ ->Array.of_list
+ ->React.array
: handleLockedLevel(currentLevel)}
}}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__AutoVerify.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__AutoVerify.res
index 1c438b6f65..5713736ee4 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__AutoVerify.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__AutoVerify.res
@@ -17,7 +17,7 @@ module AutoVerifySubmissionQuery = %graphql(`
let redirect = link => {
let window = Webapi.Dom.window
- window |> Webapi.Dom.Window.open_(~url=link, ~name="_blank", ~features="") |> ignore
+ window->Webapi.Dom.Window.open_(~url=link, ~name="_blank", ~features="")->ignore
}
let handleSuccess = (submission, linkToComplete, addSubmissionCB) => {
@@ -36,30 +36,30 @@ let handleSuccess = (submission, linkToComplete, addSubmissionCB) => {
}
let createAutoVerifySubmission = (target, linkToComplete, setSaving, addSubmissionCB, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
setSaving(_ => true)
- AutoVerifySubmissionQuery.make(~targetId=target |> Target.id, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ AutoVerifySubmissionQuery.make(~targetId=target->Target.id, ())
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
switch response["autoVerifySubmission"]["submission"] {
| Some(details) => handleSuccess(details, linkToComplete, addSubmissionCB)
| None => setSaving(_ => false)
}
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let completeButtonText = (title, iconClasses) =>
-
{title |> str}
+
{title->str}
let previewLinkToComplete = link =>
- {"Visit Link " |> str}
+ {"Visit Link "->str}
let autoVerify = (target, linkToComplete, saving, setSaving, addSubmissionCB, preview) =>
@@ -87,11 +87,11 @@ let statusBar = (string, linkToComplete) => {
-
{string |> str}
+
{string->str}
let visitLink = link =>
- {"Visit Link" |> str}
+ {"Visit Link"->str}
@@ -112,17 +112,17 @@ let completionInstructionText = linkToComplete =>
@react.component
let make = (~target, ~targetDetails, ~targetStatus, ~addSubmissionCB, ~preview) => {
let (saving, setSaving) = React.useState(() => false)
- let linkToComplete = targetDetails |> TargetDetails.linkToComplete
+ let linkToComplete = targetDetails->TargetDetails.linkToComplete
[
,
- {switch targetStatus |> TargetStatus.status {
+ {switch targetStatus->TargetStatus.status {
| Pending => autoVerify(target, linkToComplete, saving, setSaving, addSubmissionCB, preview)
| Locked(_) => React.null
| _ => statusBar("Completed", linkToComplete)
}}
,
- ] |> React.array
+ ]->React.array
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__ChecklistItem.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__ChecklistItem.res
index 7c51e571a5..8a9b12fa6d 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__ChecklistItem.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__ChecklistItem.res
@@ -27,10 +27,10 @@ let optional = t => t.optional
let make = (~result, ~title, ~optional) => {result: result, title: title, optional: optional}
let fromTargetChecklistItem = targetChecklist =>
- targetChecklist |> Array.map(tc => {
- let title = tc |> TargetChecklistItem.title
- let optional = tc |> TargetChecklistItem.optional
- let result = switch tc |> TargetChecklistItem.kind {
+ targetChecklist->Array.map(tc => {
+ let title = tc->TargetChecklistItem.title
+ let optional = tc->TargetChecklistItem.optional
+ let result = switch tc->TargetChecklistItem.kind {
| Files => Files([])
| Link => Link("")
| ShortText => ShortText("")
@@ -41,7 +41,7 @@ let fromTargetChecklistItem = targetChecklist =>
})
let updateResultAtIndex = (index, result, checklist) =>
- checklist |> Array.mapi((i, c) => i == index ? {...c, result: result} : c)
+ checklist->Array.mapi((i, c) => i == index ? {...c, result: result} : c)
let makeFile = (id, name) => {id: id, name: name}
@@ -51,13 +51,13 @@ let fileId = file => file.id
let fileIds = checklist =>
checklist
- |> Array.map(c =>
+ ->Array.map(c =>
switch c.result {
- | Files(files) => files |> Array.map(a => a.id) |> Array.to_list
+ | Files(files) => files->Array.map(a => a.id)->Array.to_list
| _anyOtherResult => list{}
}
)
- |> ArrayUtils.flatten
+ ->ArrayUtils.flatten
let kindAsString = t =>
switch t.result {
@@ -75,11 +75,11 @@ let resultAsString = t =>
| ShortText(t)
| LongText(t) => t
| MultiChoice(choices, index) =>
- index |> OptionUtils.flatMap(i => choices |> ArrayUtils.getOpt(i)) |> OptionUtils.default("")
+ index->OptionUtils.flatMap(i => choices->ArrayUtils.getOpt(i))->OptionUtils.default("")
}
let validString = (s, maxLength) => {
- let length = s |> String.trim |> String.length
+ let length = s->String.trim->String.length
length >= 1 && length <= maxLength
}
@@ -87,19 +87,19 @@ let validShortText = s => validString(s, 250)
let validLongText = s => validString(s, 5000)
-let validFiles = files => files != [] && files |> Array.length < 3
+let validFiles = files => files != [] && files->Array.length < 3
let validMultiChoice = (choices, index) =>
- index |> OptionUtils.mapWithDefault(i => choices |> Array.length > i, false)
+ index->OptionUtils.mapWithDefault(i => choices->Array.length > i, false)
let validResponse = (response, allowBlank) => {
let optional = allowBlank ? response.optional : false
switch (response.result, optional) {
| (Files(files), false) => validFiles(files)
- | (Files(files), true) => files |> ArrayUtils.isEmpty || validFiles(files)
- | (Link(link), false) => link |> UrlUtils.isValid(false)
- | (Link(link), true) => link |> UrlUtils.isValid(true)
+ | (Files(files), true) => files->ArrayUtils.isEmpty || validFiles(files)
+ | (Link(link), false) => link->UrlUtils.isValid(false)
+ | (Link(link), true) => link->UrlUtils.isValid(true)
| (ShortText(t), false) => validShortText(t)
| (ShortText(t), true) => validShortText(t) || t == ""
| (LongText(t), false) => validLongText(t)
@@ -111,43 +111,43 @@ let validResponse = (response, allowBlank) => {
let validChecklist = checklist =>
checklist
- |> Array.map(c => validResponse(c, true))
- |> Js.Array.filter(c => !c)
- |> ArrayUtils.isEmpty
+ ->Array.map(c => validResponse(c, true))
+ ->Js.Array.filter(c => !c)
+ ->ArrayUtils.isEmpty
-let validResonses = responses => responses |> Js.Array.filter(c => validResponse(c, false))
+let validResonses = responses => responses->Js.Array.filter(c => validResponse(c, false))
let encode = t => {
open Json.Encode
object_(list{
- ("title", t.title |> string),
- ("kind", kindAsString(t) |> string),
- ("status", "noAnswer" |> string),
- ("result", resultAsString(t) |> string),
+ ("title", t.title->string),
+ ("kind", kindAsString(t)->string),
+ ("status", "noAnswer"->string),
+ ("result", resultAsString(t)->string),
})
}
let encodeArray = checklist =>
- validResonses(checklist) |> {
+ validResonses(checklist)->{
open Json.Encode
array(encode)
}
let makeFiles = checklist =>
checklist
- |> Js.Array.find(c =>
+ ->Js.Array.find(c =>
switch c.result {
| Files(_files) => true
| _anyOtherResult => false
}
)
- |> OptionUtils.mapWithDefault(c =>
+ ->OptionUtils.mapWithDefault(c =>
switch c.result {
| Files(files) => files
| _anyOtherResult => []
}
, [])
- |> Array.map(f => {
+ ->Array.map(f => {
let url = "/timeline_event_files/" ++ (f.id ++ "/download")
SubmissionChecklistItem.makeFile(~name=f.name, ~id=f.id, ~url)
})
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Coach.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Coach.res
index 4b93c20338..98ac7681d9 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Coach.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Coach.res
@@ -9,7 +9,7 @@ let userId = t => t.userId
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- userId: json |> field("userId", string),
+ id: json->field("id", string),
+ userId: json->field("userId", string),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Community.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Community.res
index 6670c29a5c..1ee51b54c7 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Community.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Community.res
@@ -12,17 +12,17 @@ type t = {
let decodeQuestion = json => {
open Json.Decode
{
- questionId: json |> field("id", string),
- questionTitle: json |> field("title", string),
+ questionId: json->field("id", string),
+ questionTitle: json->field("title", string),
}
}
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- name: json |> field("name", string),
- questions: json |> field("questions", list(decodeQuestion)),
+ id: json->field("id", string),
+ name: json->field("name", string),
+ questions: json->field("questions", list(decodeQuestion)),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__CompletionInstructions.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__CompletionInstructions.res
index 0179cd438a..5083fdfa17 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__CompletionInstructions.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__CompletionInstructions.res
@@ -4,7 +4,7 @@ open CoursesCurriculum__Types
@react.component
let make = (~targetDetails, ~title) =>
- switch targetDetails |> TargetDetails.completionInstructions {
+ switch targetDetails->TargetDetails.completionInstructions {
| Some(completionInstructions) =>
@@ -12,8 +12,8 @@ let make = (~targetDetails, ~title) =>
-
{title |> str}
-
{completionInstructions |> str}
+
{title->str}
+
{completionInstructions->str}
| None => React.null
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Course.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Course.res
index 194823d7dd..979dd0745a 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Course.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Course.res
@@ -6,8 +6,8 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- endsAt: json |> field("endsAt", nullable(string)) |> Js.Null.toOption,
+ id: json->field("id", string),
+ endsAt: json->field("endsAt", nullable(string))->Js.Null.toOption,
}
}
@@ -16,6 +16,6 @@ let id = t => t.id
let hasEnded = t =>
switch t.endsAt {
- | Some(date) => date |> DateFns.parseString |> DateFns.isPast
+ | Some(date) => date->DateFns.parseString->DateFns.isPast
| None => false
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Discuss.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Discuss.res
index 68e668d1c1..e41cac3a5c 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Discuss.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Discuss.res
@@ -9,14 +9,14 @@ let linkToNewQuestion = (communityId, targetId) =>
"/communities/" ++ (communityId ++ ("/new_question" ++ ("?target_id=" ++ targetId)))
let questionCard = question => {
- let questionId = question |> Community.questionId
+ let questionId = question->Community.questionId
let questionLink = "/questions/" ++ questionId
}
@@ -25,59 +25,59 @@ let handleEmpty = () =>
- {"There's been no recent discussion about this target." |> str}
+ {"There's been no recent discussion about this target."->str}
-
{"Use the community to clear your doubts, and to help your peers!" |> str}
+
{"Use the community to clear your doubts, and to help your peers!"->str}
let actionButtons = (community, targetId) => {
- let communityId = community |> Community.id
- let communityName = community |> Community.name
+ let communityId = community->Community.id
+ let communityName = community->Community.name
}
let communityTitle = community =>
- {"Questions from " ++ ((community |> Community.name) ++ " community") |> str}
+ {"Questions from " ++ ((community->Community.name) ++ " community")->str}
@react.component
let make = (~targetId, ~communities) =>
{communities
- |> List.map(community => {
- let communityId = community |> Community.id
+ ->List.map(community => {
+ let communityId = community->Community.id
{communityTitle(community)}
{actionButtons(community, targetId)}
- {switch community |> Community.questions {
+ {switch community->Community.questions {
| list{} => handleEmpty()
| questions =>
questions
- |> List.map(question => questionCard(question))
- |> Array.of_list
- |> React.array
+ ->List.map(question => questionCard(question))
+ ->Array.of_list
+ ->React.array
}}
})
- |> Array.of_list
- |> React.array}
+ ->Array.of_list
+ ->React.array}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Feedback.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Feedback.res
index 26d2d78ca1..790035ad58 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Feedback.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Feedback.res
@@ -15,9 +15,9 @@ let feedback = t => t.feedback
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- coachId: json |> field("coachId", string),
- submissionId: json |> field("submissionId", string),
- feedback: json |> field("feedback", string),
+ id: json->field("id", string),
+ coachId: json->field("coachId", string),
+ submissionId: json->field("submissionId", string),
+ feedback: json->field("feedback", string),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__FileForm.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__FileForm.res
index 1f95a0d166..c454d42a9c 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__FileForm.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__FileForm.res
@@ -24,7 +24,7 @@ let reducer = (state, action) =>
}
let handleResponseJSON = (filename, send, attachFileCB, json) => {
- let id = json |> {
+ let id = json->{
open Json.Decode
field("id", string)
}
@@ -48,19 +48,19 @@ let uploadFile = (filename, send, attachFileCB, formData) => {
(),
),
)
- |> then_(response =>
+ ->then_(response =>
if Fetch.Response.ok(response) {
- response |> Fetch.Response.json
+ response->Fetch.Response.json
} else {
- Js.Promise.reject(UnexpectedResponse(response |> Fetch.Response.status))
+ Js.Promise.reject(UnexpectedResponse(response->Fetch.Response.status))
}
)
- |> then_(json => handleResponseJSON(filename, send, attachFileCB, json) |> resolve)
- |> catch(error =>
- switch error |> handleApiError {
+ ->then_(json => handleResponseJSON(filename, send, attachFileCB, json)->resolve)
+ ->catch(error =>
+ switch error->handleApiError {
| Some(code) =>
Notification.error(
- "Error " ++ (code |> string_of_int),
+ "Error " ++ (code->string_of_int),
"Please reload the page and try again.",
)
| None =>
@@ -68,16 +68,16 @@ let uploadFile = (filename, send, attachFileCB, formData) => {
"Something went wrong!",
"Our team has been notified of this error. Please reload the page and try again.",
)
- } |> resolve
+ }->resolve
)
- |> ignore
+ ->ignore
}
let submitForm = (filename, formId, send, addFileAttachmentCB) => {
let element = ReactDOMRe._getElementById(formId)
switch element {
| Some(element) =>
- DomUtils.FormData.create(element) |> uploadFile(filename, send, addFileAttachmentCB)
+ DomUtils.FormData.create(element)->uploadFile(filename, send, addFileAttachmentCB)
| None => raise(FormNotFound(formId))
}
}
@@ -93,7 +93,7 @@ let attachFile = (state, send, attachingCB, attachFileCB, preview, event) =>
let errors = file["size"] > maxFileSize ? list{"The maximum file size is 5 MB."} : list{}
- if errors |> ListUtils.isEmpty {
+ if errors->ListUtils.isEmpty {
let filename = file["name"]
attachingCB(true)
send(AttachFile(filename))
@@ -108,7 +108,7 @@ let make = (~attachFileCB, ~attachingCB, ~preview) => {
let (state, send) = React.useReducer(
reducer,
{
- formId: Random.int(99999) |> string_of_int,
+ formId: Random.int(99999)->string_of_int,
filename: defaultTitle,
errors: list{},
},
@@ -131,22 +131,22 @@ let make = (~attachFileCB, ~attachingCB, ~preview) => {
htmlFor="attachment_file">
- {state.filename |> str}
+ {state.filename->str}
{state.errors
- |> List.map(error =>
+ ->List.map(error =>
- {error |> str}
+ {error->str}
)
- |> Array.of_list
- |> React.array}
- {state.errors |> ListUtils.isEmpty
+ ->Array.of_list
+ ->React.array}
+ {state.errors->ListUtils.isEmpty
? React.null
:
- {"Please choose another file for upload." |> str}
+ {"Please choose another file for upload."->str}
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Grade.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Grade.res
index d92cf72613..576005e622 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Grade.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Grade.res
@@ -7,20 +7,20 @@ type t = {
let decode = json => {
open Json.Decode
{
- submissionId: json |> field("submissionId", string),
- evaluationCriterionId: json |> field("evaluationCriterionId", string),
- grade: json |> field("grade", int),
+ submissionId: json->field("submissionId", string),
+ evaluationCriterionId: json->field("evaluationCriterionId", string),
+ grade: json->field("grade", int),
}
}
let sort = (criteria, grades) =>
grades
- |> Array.of_list
- |> ArrayUtils.copyAndSort((g1, g2) => {
+ ->Array.of_list
+ ->ArrayUtils.copyAndSort((g1, g2) => {
let ec1 =
criteria
- |> Array.of_list
- |> ArrayUtils.unsafeFind(
+ ->Array.of_list
+ ->ArrayUtils.unsafeFind(
ec => EvaluationCriterion.id(ec) == g1.evaluationCriterionId,
"Unable to find evaluation criterion with ID: " ++
(g1.evaluationCriterionId ++
@@ -28,16 +28,16 @@ let sort = (criteria, grades) =>
)
let ec2 =
criteria
- |> Array.of_list
- |> ArrayUtils.unsafeFind(
+ ->Array.of_list
+ ->ArrayUtils.unsafeFind(
ec => EvaluationCriterion.id(ec) == g2.evaluationCriterionId,
"Unable to find evaluation criterion with ID: " ++
(g2.evaluationCriterionId ++
" in CoursesCurriculum__Grade"),
)
- String.compare(ec1 |> EvaluationCriterion.name, ec2 |> EvaluationCriterion.name)
+ String.compare(ec1->EvaluationCriterion.name, ec2->EvaluationCriterion.name)
})
- |> Array.to_list
+ ->Array.to_list
let grade = t => t.grade
let submissionId = t => t.submissionId
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__GradeBar.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__GradeBar.res
index 75fa164141..fc3629d4cd 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__GradeBar.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__GradeBar.res
@@ -5,20 +5,20 @@ let str = React.string
open CoursesCurriculum__Types
let gradeDescription = (gradeLabels, grading) =>
- {grading |> Grading.criterionName |> str}
- {switch grading |> Grading.grade {
+ {grading->Grading.criterionName->str}
+ {switch grading->Grading.grade {
| Some(grade) =>
- {": " |> str}
+ {": "->str}
- {grade |> GradeLabel.labelFor(gradeLabels) |> str}
+ {grade->GradeLabel.labelFor(gradeLabels)->str}
| None => ReasonReact.null
}}
-let maxGrade = gradeLabels => gradeLabels |> GradeLabel.maxGrade |> string_of_int
+let maxGrade = gradeLabels => gradeLabels->GradeLabel.maxGrade->string_of_int
let gradePillClasses = (gradeReceived, passGrade, pillGrade, callBack) => {
let defaultClasses = "grade-bar__grade-pill cursor-auto"
@@ -40,12 +40,12 @@ let gradePillClasses = (gradeReceived, passGrade, pillGrade, callBack) => {
let gradeBarHeader = (grading, gradeLabels) =>
- {grading |> gradeDescription(gradeLabels)}
- {switch grading |> Grading.grade {
+ {grading->gradeDescription(gradeLabels)}
+ {switch grading->Grading.grade {
| None => ReasonReact.null
| Some(grade) =>
- {(grade |> string_of_int) ++ ("/" ++ maxGrade(gradeLabels)) |> str}
+ {(grade->string_of_int) ++ ("/" ++ maxGrade(gradeLabels))->str}
}}
@@ -53,20 +53,20 @@ let gradeBarHeader = (grading, gradeLabels) =>
let handleClick = (gradeSelectCB, grading, newGrade) =>
switch gradeSelectCB {
| None => ()
- | Some(callBack) => callBack(grading |> Grading.updateGrade(newGrade))
+ | Some(callBack) => callBack(grading->Grading.updateGrade(newGrade))
}
let gradeBarPill = (gradeLabel, grading, gradeSelectCB, passGrade) => {
- let myGrade = gradeLabel |> GradeLabel.grade
+ let myGrade = gradeLabel->GradeLabel.grade
string_of_int}
- title={gradeLabel |> GradeLabel.label}
+ key={myGrade->string_of_int}
+ title={gradeLabel->GradeLabel.label}
role="button"
onClick={_event => handleClick(gradeSelectCB, grading, myGrade)}
- className={gradePillClasses(grading |> Grading.grade, passGrade, myGrade, gradeSelectCB)}>
+ className={gradePillClasses(grading->Grading.grade, passGrade, myGrade, gradeSelectCB)}>
{switch gradeSelectCB {
| None => ReasonReact.null
- | Some(_CB) => myGrade |> string_of_int |> str
+ | Some(_CB) => myGrade->string_of_int->str
}}
}
@@ -74,15 +74,15 @@ let gradeBarPill = (gradeLabel, grading, gradeSelectCB, passGrade) => {
let gradeBarPanel = (grading, gradeLabels, gradeSelectCB, passGrade) =>
{gradeLabels
- |> List.map(gradeLabel => gradeBarPill(gradeLabel, grading, gradeSelectCB, passGrade))
- |> Array.of_list
- |> ReasonReact.array}
+ ->List.map(gradeLabel => gradeBarPill(gradeLabel, grading, gradeSelectCB, passGrade))
+ ->Array.of_list
+ ->ReasonReact.array}
@react.component
let make = (~grading, ~gradeSelectCB=?, ~criterion) => {
- let gradeLabels = criterion |> EvaluationCriterion.gradesAndLabels |> Array.to_list
- let passGrade = criterion |> EvaluationCriterion.passGrade
+ let gradeLabels = criterion->EvaluationCriterion.gradesAndLabels->Array.to_list
+ let passGrade = criterion->EvaluationCriterion.passGrade
{gradeBarHeader(grading, gradeLabels)}
{gradeBarPanel(grading, gradeLabels, gradeSelectCB, passGrade)}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Grading.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Grading.res
index fc9d66d1bd..c0a18faadf 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Grading.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Grading.res
@@ -7,15 +7,15 @@ type t = {
let decode = json => {
open Json.Decode
{
- criterionId: json |> field("criterionId", string),
- criterionName: json |> field("criterionName", string),
- grade: json |> field("grade", nullable(int)) |> Js.Null.toOption,
+ criterionId: json->field("criterionId", string),
+ criterionName: json->field("criterionName", string),
+ grade: json->field("grade", nullable(int))->Js.Null.toOption,
}
}
let grade = t => t.grade
-let pending = evaluation => evaluation |> List.exists(grading => grading.grade == None)
+let pending = evaluation => evaluation->List.exists(grading => grading.grade == None)
let isFail = (passGrade, grading) =>
switch grading.grade {
@@ -24,7 +24,7 @@ let isFail = (passGrade, grading) =>
}
let anyFail = (passGrade, evaluation) =>
- evaluation |> List.exists(grading => grading |> isFail(passGrade))
+ evaluation->List.exists(grading => grading->isFail(passGrade))
let criterionId = t => t.criterionId
@@ -39,11 +39,11 @@ let updateGrade = (newGrade, t) => {
let gradingEncoder = grading => {
open Json.Encode
object_(list{
- ("criterionId", grading.criterionId |> string),
+ ("criterionId", grading.criterionId->string),
(
"grade",
switch grading.grade {
- | Some(grade) => grade |> int
+ | Some(grade) => grade->int
| None => null
},
),
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__LatestSubmission.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__LatestSubmission.res
index a2d1c08298..7ce36ea752 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__LatestSubmission.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__LatestSubmission.res
@@ -7,9 +7,9 @@ type t = {
let decode = json => {
open Json.Decode
{
- targetId: json |> field("targetId", string),
- passedAt: json |> field("passedAt", nullable(string)) |> Js.Null.toOption,
- evaluatorId: json |> field("evaluatorId", nullable(string)) |> Js.Null.toOption,
+ targetId: json->field("targetId", string),
+ passedAt: json->field("passedAt", nullable(string))->Js.Null.toOption,
+ evaluatorId: json->field("evaluatorId", nullable(string))->Js.Null.toOption,
}
}
@@ -29,6 +29,6 @@ let hasBeenEvaluated = t =>
let make = (~pending, ~targetId) => {
targetId: targetId,
- passedAt: pending ? None : Some(Js.Date.make() |> Js.Date.toISOString),
+ passedAt: pending ? None : Some(Js.Date.make()->Js.Date.toISOString),
evaluatorId: None,
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Learn.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Learn.res
index fd08cb593b..64c2eb1f89 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Learn.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Learn.res
@@ -3,6 +3,6 @@ open CoursesCurriculum__Types
@react.component
let make = (~targetDetails) => {
let contentBlocks =
- targetDetails |> TargetDetails.contentBlocks |> Array.of_list |> ContentBlock.sort
+ targetDetails->TargetDetails.contentBlocks->Array.of_list->ContentBlock.sort
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Level.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Level.res
index 385e0be942..daed165c5e 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Level.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Level.res
@@ -8,10 +8,10 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- name: json |> field("name", string),
- number: json |> field("number", int),
- unlockOn: json |> field("unlockOn", nullable(string)) |> Js.Null.toOption,
+ id: json->field("id", string),
+ name: json->field("name", string),
+ number: json->field("number", int),
+ unlockOn: json->field("unlockOn", nullable(string))->Js.Null.toOption,
}
}
@@ -22,16 +22,16 @@ let unlockOn = t => t.unlockOn
let isUnlocked = t =>
switch t.unlockOn {
- | Some(date) => date |> DateFns.parseString |> DateFns.isPast
+ | Some(date) => date->DateFns.parseString->DateFns.isPast
| None => true
}
-let isLocked = t => !(t |> isUnlocked)
+let isLocked = t => !(t->isUnlocked)
-let sort = levels => levels |> List.sort((x, y) => x.number - y.number)
+let sort = levels => levels->List.sort((x, y) => x.number - y.number)
let first = levels =>
- switch levels |> sort {
+ switch levels->sort {
| list{} =>
Rollbar.error("Failed to find the first level from a course's levels.")
raise(Not_found)
@@ -43,13 +43,13 @@ let unlockDateString = t =>
| None =>
Rollbar.error("unlockDateString was called for a CoursesCurriculum__Level without unlockOn")
""
- | Some(unlockOn) => unlockOn |> DateFns.parseString |> DateFns.format("MMM D")
+ | Some(unlockOn) => unlockOn->DateFns.parseString->DateFns.format("MMM D")
}
let findByLevelNumber = (levels, levelNumber) =>
- levels |> List.find_opt(l => l.number == levelNumber)
+ levels->List.find_opt(l => l.number == levelNumber)
-let next = (levels, t) => t.number + 1 |> findByLevelNumber(levels)
+let next = (levels, t) => t.number + 1->findByLevelNumber(levels)
let previous = (levels, t) => {
let previousLevelNumber = t.number - 1
@@ -57,6 +57,6 @@ let previous = (levels, t) => {
if previousLevelNumber == 0 {
None
} else {
- previousLevelNumber |> findByLevelNumber(levels)
+ previousLevelNumber->findByLevelNumber(levels)
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__LevelSelector.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__LevelSelector.res
index fdf4fb1504..1b0d6950d0 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__LevelSelector.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__LevelSelector.res
@@ -10,19 +10,19 @@ let levelZeroSelectorClasses = isSelected => {
}
let levelName = level =>
- "L" ++ ((level |> Level.number |> string_of_int) ++ (": " ++ (level |> Level.name)))
+ "L" ++ ((level->Level.number->string_of_int) ++ (": " ++ (level->Level.name)))
let selectableLevels = (orderedLevels, teamLevel, setSelectedLevelId) => {
- let teamLevelNumber = teamLevel |> Level.number
+ let teamLevelNumber = teamLevel->Level.number
orderedLevels
- |> List.map(level => {
- let levelNumber = level |> Level.number
+ ->List.map(level => {
+ let levelNumber = level->Level.number
let icon = if levelNumber < teamLevelNumber {
"fas fa-check text-green-500"
} else if levelNumber == teamLevelNumber {
"fas fa-map-marker-alt text-blue-400"
- } else if level |> Level.isUnlocked {
+ } else if level->Level.isUnlocked {
"inline-block"
} else {
"fas fa-lock text-gray-600"
@@ -30,20 +30,20 @@ let selectableLevels = (orderedLevels, teamLevel, setSelectedLevelId) => {
})
- |> Array.of_list
+ ->Array.of_list
}
let untabbedLevelSelector = (selectedLevel, orderedLevels, teamLevel, setSelectedLevelId) => {
let selected =
@@ -68,7 +68,7 @@ let tabbedLevelSelector = (
@@ -93,9 +93,9 @@ let tabbedLevelSelector = (
className={"border-l rounded-r-lg bg-white border-gray-400 font-semibold truncate hover:bg-gray-100 hover:text-primary-500 " ++
levelZeroSelectorClasses(showLevelZero)}
onClick={_e => setShowLevelZero(true)}>
- {levelZero |> Level.name |> str}
+ {levelZero->Level.name->str}
,
- ] |> React.array
+ ]->React.array
}
@react.component
@@ -108,7 +108,7 @@ let make = (
~setShowLevelZero,
~levelZero,
) => {
- let orderedLevels = levels |> List.filter(l => l |> Level.number != 0) |> Level.sort
+ let orderedLevels = levels->List.filter(l => l->Level.number != 0)->Level.sort
{
let submitButtonText = (title, iconClasses) =>
-
{title |> str}
+
{title->str}
saving
? submitButtonText("Saving", "fas fa-spinner fa-spin")
@@ -21,20 +21,20 @@ let handleSubmitButton = saving => {
let refreshPage = () => {
open Webapi.Dom
- location |> Location.reload
+ location->Location.reload
}
let createLevelUpQuery = (course, setSaving, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
setSaving(_ => true)
- LevelUpQuery.make(~courseId=course |> Course.id, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ LevelUpQuery.make(~courseId=course->Course.id, ())
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
response["levelUp"]["success"] ? refreshPage() : setSaving(_ => false)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
@react.component
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__NoticeManager.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__NoticeManager.res
index 8646fe3c04..3011f1ee74 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__NoticeManager.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__NoticeManager.res
@@ -10,9 +10,9 @@ let showNotice = (
(),
) =>
-

Notice.icon} />
-
{title |> str}
-
{description |> str}
+

Notice.icon} />
+
{title->str}
+
{description->str}
let courseCompletedMessage = () => {
@@ -32,9 +32,9 @@ let showPreviewMessage = () =>
className="flex max-w-lg md:mx-auto mx-3 mt-4 rounded-lg px-3 py-2 shadow-lg items-center border border-primary-300 bg-gray-200 ">
-
{"Preview Mode" |> str}
+
{"Preview Mode"->str}
- {"You are accessing the preview mode for this course" |> str}
+ {"You are accessing the preview mode for this course"->str}
@@ -47,8 +47,8 @@ let accessEndedMessage = () => {
let levelUpBlockedMessage = levelNumber => {
let title = "Level Up Blocked"
- let currentLevel = levelNumber |> string_of_int
- let lastLevel = levelNumber - 1 |> string_of_int
+ let currentLevel = levelNumber->string_of_int
+ let lastLevel = levelNumber - 1->string_of_int
let description =
"You're at Level " ++
(currentLevel ++
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Overlay.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Overlay.res
index 4832f81c6f..5ca46e85df 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Overlay.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Overlay.res
@@ -38,27 +38,27 @@ let reducer = (state, action) =>
| Target.Student => state
| Team => {
...state,
- targetDetails: state.targetDetails |> OptionUtils.map(TargetDetails.clearPendingUserIds),
+ targetDetails: state.targetDetails->OptionUtils.map(TargetDetails.clearPendingUserIds),
}
}
}
let closeOverlay = course =>
- ReasonReactRouter.push("/courses/" ++ ((course |> Course.id) ++ "/curriculum"))
+ ReasonReactRouter.push("/courses/" ++ ((course->Course.id) ++ "/curriculum"))
let loadTargetDetails = (target, send, ()) => {
{
open Js.Promise
- Fetch.fetch("/targets/" ++ ((target |> Target.id) ++ "/details_v2"))
- |> then_(Fetch.Response.json)
- |> then_(json => send(SetTargetDetails(json |> TargetDetails.decode)) |> resolve)
- } |> ignore
+ Fetch.fetch("/targets/" ++ ((target->Target.id) ++ "/details_v2"))
+ ->then_(Fetch.Response.json)
+ ->then_(json => send(SetTargetDetails(json->TargetDetails.decode))->resolve)
+ }->ignore
None
}
let completionTypeToString = (completionType, targetStatus) =>
- switch (targetStatus |> TargetStatus.status, (completionType: TargetDetails.completionType)) {
+ switch (targetStatus->TargetStatus.status, (completionType: TargetDetails.completionType)) {
| (Pending, Evaluated) => "Complete"
| (Pending, TakeQuiz) => "Take Quiz"
| (Pending, LinkToComplete) => "Visit Link to Complete"
@@ -79,7 +79,7 @@ let tabToString = (targetStatus, tab) =>
}
let selectableTabs = targetDetails =>
- targetDetails |> TargetDetails.communities |> ListUtils.isNotEmpty
+ targetDetails->TargetDetails.communities->ListUtils.isNotEmpty
? list{Learn, Discuss}
: list{Learn}
@@ -91,14 +91,14 @@ let tabClasses = (selection, tab) =>
)
let scrollCompleteButtonIntoViewEventually = () => Js.Global.setTimeout(() => {
- let element = Webapi.Dom.document |> Webapi.Dom.Document.getElementById("auto-verify-target")
+ let element = Webapi.Dom.document->Webapi.Dom.Document.getElementById("auto-verify-target")
switch element {
| Some(e) =>
Webapi.Dom.Element.scrollIntoView(e)
e->Webapi.Dom.Element.setClassName("mt-4 complete-button-selected")
| None => Rollbar.error("Could not find the 'Complete' button to scroll to.")
}
- }, 50) |> ignore
+ }, 50)->ignore
let handleTablink = (send, _event) => {
send(Select(Learn))
@@ -107,30 +107,30 @@ let handleTablink = (send, _event) => {
let tabButton = (tab, state, send, targetStatus) =>
tabToString(targetStatus))}
+ key={"select-" ++ (tab->tabToString(targetStatus))}
className={tabClasses(tab, state.tab)}
onClick={_e => send(Select(tab))}>
- {tab |> tabToString(targetStatus) |> str}
+ {tab->tabToString(targetStatus)->str}
let tabLink = (tab, state, send, targetStatus) =>
- {tab |> tabToString(targetStatus) |> str}
+ {tab->tabToString(targetStatus)->str}
let tabOptions = (state, send, targetDetails, targetStatus) => {
- let completionType = targetDetails |> TargetDetails.computeCompletionType
+ let completionType = targetDetails->TargetDetails.computeCompletionType
{selectableTabs(targetDetails)
- |> List.map(selection => tabButton(selection, state, send, targetStatus))
- |> Array.of_list
- |> React.array}
- {switch (targetStatus |> TargetStatus.status, completionType) {
+ ->List.map(selection => tabButton(selection, state, send, targetStatus))
+ ->Array.of_list
+ ->React.array}
+ {switch (targetStatus->TargetStatus.status, completionType) {
| (Pending | Submitted | Passed | Failed, Evaluated | TakeQuiz) =>
tabButton(Complete(completionType), state, send, targetStatus)
| (Locked(CourseLocked | AccessLocked), Evaluated | TakeQuiz) =>
- targetDetails |> TargetDetails.submissions |> ListUtils.isNotEmpty
+ targetDetails->TargetDetails.submissions->ListUtils.isNotEmpty
? tabButton(Complete(completionType), state, send, targetStatus)
: React.null
| (Pending | Submitted | Passed | Failed, LinkToComplete | MarkAsComplete) =>
@@ -143,16 +143,16 @@ let tabOptions = (state, send, targetDetails, targetStatus) => {
let addSubmission = (target, state, send, addSubmissionCB, submission) => {
switch state.targetDetails {
| Some(targetDetails) =>
- let newTargetDetails = targetDetails |> TargetDetails.addSubmission(submission)
+ let newTargetDetails = targetDetails->TargetDetails.addSubmission(submission)
send(SetTargetDetails(newTargetDetails))
| None => ()
}
- switch submission |> Submission.status {
+ switch submission->Submission.status {
| MarkedAsComplete =>
- addSubmissionCB(LatestSubmission.make(~pending=false, ~targetId=target |> Target.id))
- | Pending => addSubmissionCB(LatestSubmission.make(~pending=true, ~targetId=target |> Target.id))
+ addSubmissionCB(LatestSubmission.make(~pending=false, ~targetId=target->Target.id))
+ | Pending => addSubmissionCB(LatestSubmission.make(~pending=true, ~targetId=target->Target.id))
| Passed =>
raise(
UnexpectedSubmissionStatus(
@@ -171,16 +171,16 @@ let addSubmission = (target, state, send, addSubmissionCB, submission) => {
let addVerifiedSubmission = (target, state, send, addSubmissionCB, submission) => {
switch state.targetDetails {
| Some(targetDetails) =>
- let newTargetDetails = targetDetails |> TargetDetails.addSubmission(submission)
+ let newTargetDetails = targetDetails->TargetDetails.addSubmission(submission)
send(SetTargetDetails(newTargetDetails))
| None => ()
}
- addSubmissionCB(LatestSubmission.make(~pending=false, ~targetId=target |> Target.id))
+ addSubmissionCB(LatestSubmission.make(~pending=false, ~targetId=target->Target.id))
}
let targetStatusClass = (prefix, targetStatus) =>
- prefix ++ (targetStatus |> TargetStatus.statusToString |> Js.String.toLowerCase)
+ prefix ++ (targetStatus->TargetStatus.statusToString->Js.String.toLowerCase)
let targetStatusClasses = targetStatus =>
"curriculum__target-status bg-white text-xs mt-2 md:mt-0 py-1 px-2 md:px-4 " ++
@@ -193,7 +193,7 @@ let overlayHeaderTitleCardClasses = targetStatus =>
let renderLocked = text =>
- {text |> str}
+ {text->str}
let overlayStatus = (course, target, targetStatus, preview) =>
@@ -203,14 +203,14 @@ let overlayStatus = (course, target, targetStatus, preview) =>
targetStatusClass("course-overlay__close--", targetStatus)}
onClick={_e => closeOverlay(course)}>
-
{"Close" |> str}
+
{"Close"->str}
- {target |> Target.title |> str}
+ {target->Target.title->str}
- {targetStatus |> TargetStatus.statusToString |> str}
+ {targetStatus->TargetStatus.statusToString->str}
@@ -219,42 +219,42 @@ let overlayStatus = (course, target, targetStatus, preview) =>
: React.null}
-let renderLockReason = reason => renderLocked(reason |> TargetStatus.lockReasonToString)
+let renderLockReason = reason => renderLocked(reason->TargetStatus.lockReasonToString)
let prerequisitesIncomplete = (reason, target, targets, statusOfTargets) => {
- let prerequisiteTargetIds = target |> Target.prerequisiteTargetIds
+ let prerequisiteTargetIds = target->Target.prerequisiteTargetIds
let prerequisiteTargets =
- targets |> List.filter(target => (target |> Target.id)->List.mem(prerequisiteTargetIds))
+ targets->List.filter(target => (target->Target.id)->List.mem(prerequisiteTargetIds))
{renderLockReason(reason)}
{prerequisiteTargets
- |> List.map(target => {
+ ->List.map(target => {
let targetStatus =
- statusOfTargets |> List.find(ts => ts |> TargetStatus.targetId == (target |> Target.id))
+ statusOfTargets->List.find(ts => ts->TargetStatus.targetId == (target->Target.id))
Target.id)}
- ariaLabel={"Select Target " ++ (target |> Target.id)}
- key={target |> Target.id}
+ href={"/targets/" ++ (target->Target.id)}
+ ariaLabel={"Select Target " ++ (target->Target.id)}
+ key={target->Target.id}
className="bg-white border-t px-6 py-4 relative z-10 flex items-center justify-between hover:bg-gray-200 hover:text-primary-500 cursor-pointer">
- {target |> Target.title |> str}
+ {target->Target.title->str}
- {targetStatus |> TargetStatus.statusToString |> str}
+ {targetStatus->TargetStatus.statusToString->str}
})
- |> Array.of_list
- |> React.array}
+ ->Array.of_list
+ ->React.array}
}
let handleLocked = (target, targets, targetStatus, statusOfTargets) =>
- switch targetStatus |> TargetStatus.status {
+ switch targetStatus->TargetStatus.status {
| Locked(reason) =>
switch reason {
| PrerequisitesIncomplete => prerequisitesIncomplete(reason, target, targets, statusOfTargets)
@@ -279,7 +279,7 @@ let learnSection = (targetDetails, tab) =>
let discussSection = (target, targetDetails, tab) =>
Target.id} communities={targetDetails |> TargetDetails.communities}
+ targetId={target->Target.id} communities={targetDetails->TargetDetails.communities}
/>
@@ -303,12 +303,12 @@ let completeSection = (
users,
preview,
) => {
- let completionType = targetDetails |> TargetDetails.computeCompletionType
+ let completionType = targetDetails->TargetDetails.computeCompletionType
let addVerifiedSubmissionCB = addVerifiedSubmission(target, state, send, addSubmissionCB)
- {switch (targetStatus |> TargetStatus.status, completionType) {
+ {switch (targetStatus->TargetStatus.status, completionType) {
| (Pending, Evaluated) =>
[
TargetDetails.checklist}
+ checklist={targetDetails->TargetDetails.checklist}
addSubmissionCB={addSubmission(target, state, send, addSubmissionCB)}
preview
/>,
- ] |> React.array
+ ]->React.array
| (Pending, TakeQuiz) =>
[
,
- ] |> React.array
+ ]->React.array
| (Submitted | Passed | Failed | Locked(CourseLocked | AccessLocked), Evaluated | TakeQuiz) =>
TargetDetails.checklist}
+ checklist={targetDetails->TargetDetails.checklist}
/>
| (Pending | Submitted | Passed | Failed, LinkToComplete | MarkAsComplete) =>
- {"You have team members who are yet to complete this target:" |> str}
+ {"You have team members who are yet to complete this target:"->str}
{pendingUserIds
- |> List.map(studentId => {
+ ->List.map(studentId => {
let user =
- users |> ListUtils.unsafeFind(
- u => u |> User.id == studentId,
+ users->ListUtils.unsafeFind(
+ u => u->User.id == studentId,
"Unable to find user with id " ++ (studentId ++ "in CoursesCurriculum__Overlay"),
)
User.name) ++ " has not completed this target."}
+ title={(user->User.name) ++ " has not completed this target."}
className="w-10 h-10 rounded-full border border-yellow-400 flex items-center justify-center overflow-hidden mx-1 shadow-md flex-shrink-0 mt-2">
-

User.avatarUrl} />
+

User.avatarUrl} />
})
- |> Array.of_list
- |> React.array}
+ ->Array.of_list
+ ->React.array}
let handlePendingStudents = (targetStatus, targetDetails, users) =>
- switch (targetDetails, targetStatus |> TargetStatus.status) {
+ switch (targetDetails, targetStatus->TargetStatus.status) {
| (Some(targetDetails), Submitted | Passed) =>
- let pendingUserIds = targetDetails |> TargetDetails.pendingUserIds
- pendingUserIds |> ListUtils.isNotEmpty
+ let pendingUserIds = targetDetails->TargetDetails.pendingUserIds
+ pendingUserIds->ListUtils.isNotEmpty
? renderPendingStudents(pendingUserIds, users)
: React.null
| (Some(_) | None, Locked(_) | Pending | Submitted | Passed | Failed) => React.null
@@ -396,7 +396,7 @@ let performQuickNavigation = (send, _event) => {
{
open // Scroll to the top of the overlay before pushing the new URL.
Webapi.Dom
- switch document |> Document.getElementById("target-overlay") {
+ switch document->Document.getElementById("target-overlay") {
| Some(element) => Webapi.Dom.Element.setScrollTop(element, 0.0)
| None => ()
}
@@ -420,7 +420,7 @@ let navigationLink = (direction, url, send) => {
onClick={performQuickNavigation(send)}
className="block p-2 md:p-4 text-center border rounded-lg bg-gray-100 hover:bg-gray-200">
{arrow(leftIcon)}
- {text |> str}
+ {text->str}
{arrow(rightIcon)}
}
@@ -428,13 +428,13 @@ let navigationLink = (direction, url, send) => {
let scrollOverlayToTop = _event => {
let element = {
open Webapi.Dom
- document |> Document.getElementById("target-overlay")
+ document->Document.getElementById("target-overlay")
}
element->Belt.Option.mapWithDefault((), element => element->Webapi.Dom.Element.setScrollTop(0.0))
}
let quickNavigationLinks = (targetDetails, send) => {
- let (previous, next) = targetDetails |> TargetDetails.navigation
+ let (previous, next) = targetDetails->TargetDetails.navigation
@@ -448,7 +448,7 @@ let quickNavigationLinks = (targetDetails, send) => {
@@ -462,7 +462,7 @@ let quickNavigationLinks = (targetDetails, send) => {
}
let updatePendingUserIdsWhenAddingSubmission = (send, target, addSubmissionCB, submission) => {
- send(AddSubmission(target |> Target.role))
+ send(AddSubmission(target->Target.role))
addSubmissionCB(submission)
}
@@ -481,7 +481,7 @@ let make = (
) => {
let (state, send) = React.useReducer(reducer, initialState)
- React.useEffect1(loadTargetDetails(target, send), [target |> Target.id])
+ React.useEffect1(loadTargetDetails(target, send), [target->Target.id])
React.useEffect(() => {
ScrollLock.activate()
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Quiz.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Quiz.res
index a494678913..b1b012b2fe 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Quiz.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Quiz.res
@@ -19,16 +19,16 @@ module CreateQuizSubmissionQuery = %graphql(`
let createQuizSubmission = (target, selectedAnswersIds, setSaving, addSubmissionCB) => {
setSaving(_ => true)
CreateQuizSubmissionQuery.make(
- ~targetId=target |> Target.id,
- ~answerIds=selectedAnswersIds |> Array.of_list,
+ ~targetId=target->Target.id,
+ ~answerIds=selectedAnswersIds->Array.of_list,
(),
)
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
switch response["createQuizSubmission"]["submission"] {
| Some(submission) =>
let checklist =
- submission["checklist"] |> Json.Decode.array(SubmissionChecklistItem.decode([]))
+ submission["checklist"]->Json.Decode.array(SubmissionChecklistItem.decode([]))
addSubmissionCB(
Submission.make(
~id=submission["id"],
@@ -41,7 +41,7 @@ let createQuizSubmission = (target, selectedAnswersIds, setSaving, addSubmission
}
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let answerOptionClasses = (answerOption, selectedAnswer) => {
let defaultClasses = "quiz-root__answer bg-white flex items-center shadow border border-transparent rounded p-3 mt-3 cursor-pointer "
@@ -63,48 +63,48 @@ let iconClasses = (answerOption, selectedAnswer) => {
}
let handleSubmit = (answer, target, selectedAnswersIds, setSaving, addSubmissionCB, event) => {
- event |> ReactEvent.Mouse.preventDefault
- let answerIds = selectedAnswersIds |> List.append(list{answer |> QuizQuestion.answerId})
+ event->ReactEvent.Mouse.preventDefault
+ let answerIds = selectedAnswersIds->List.append(list{answer->QuizQuestion.answerId})
createQuizSubmission(target, answerIds, setSaving, addSubmissionCB)
}
@react.component
let make = (~target, ~targetDetails, ~addSubmissionCB, ~preview) => {
- let quizQuestions = targetDetails |> TargetDetails.quizQuestions
+ let quizQuestions = targetDetails->TargetDetails.quizQuestions
let (saving, setSaving) = React.useState(() => false)
- let (selectedQuestion, setSelectedQuestion) = React.useState(() => quizQuestions |> List.hd)
+ let (selectedQuestion, setSelectedQuestion) = React.useState(() => quizQuestions->List.hd)
let (selectedAnswer, setSelectedAnswer) = React.useState(() => None)
let (selectedAnswersIds, setSelectedAnswersIds) = React.useState(() => list{})
let currentQuestion = selectedQuestion
- {"Question #" |> str} {string_of_int((currentQuestion |> QuizQuestion.index) + 1) |> str}
+ {"Question #"->str} {string_of_int((currentQuestion->QuizQuestion.index) + 1)->str}
QuizQuestion.question}
+ markdown={currentQuestion->QuizQuestion.question}
className="font-semibold text-lg md:text-xl"
profile=Markdown.Permissive
/>
{currentQuestion
- |> QuizQuestion.answerOptions
- |> List.map(answerOption =>
+ ->QuizQuestion.answerOptions
+ ->List.map(answerOption =>
QuizQuestion.answerId}
+ key={answerOption->QuizQuestion.answerId}
onClick={_ => setSelectedAnswer(_ => Some(answerOption))}>
QuizQuestion.answerValue}
+ markdown={answerOption->QuizQuestion.answerValue}
className="overflow-auto ml-2 w-full"
profile=Markdown.Permissive
/>
)
- |> Array.of_list
- |> React.array}
+ ->Array.of_list
+ ->React.array}
{switch selectedAnswer {
@@ -112,7 +112,7 @@ let make = (~target, ~targetDetails, ~addSubmissionCB, ~preview) => {
| Some(answer) =>
- {currentQuestion |> QuizQuestion.isLastQuestion(quizQuestions)
+ {currentQuestion->QuizQuestion.isLastQuestion(quizQuestions)
?
: {
- let nextQuestion = currentQuestion |> QuizQuestion.nextQuestion(quizQuestions)
+ let nextQuestion = currentQuestion->QuizQuestion.nextQuestion(quizQuestions)
: React.null
@@ -117,38 +117,38 @@ let showMultiChoice = (choices, choice, id, updateResultCB) =>
{choices
- |> Array.mapi((index, label) => {
- let checked = choice |> OptionUtils.mapWithDefault(i => i == index, false)
+ ->Array.mapi((index, label) => {
+ let checked = choice->OptionUtils.mapWithDefault(i => i == index, false)
string_of_int}
- id={id ++ (index |> string_of_int)}
+ key={index->string_of_int}
+ id={id ++ (index->string_of_int)}
label
onChange={checkboxOnChange(choices, index, updateResultCB)}
checked
/>
})
- |> React.array}
+ ->React.array}
let attachFile = (updateResultCB, attachingCB, files, id, filename) => {
attachingCB(false)
- updateResultCB(ChecklistItem.Files(files |> Array.append([ChecklistItem.makeFile(id, filename)])))
+ updateResultCB(ChecklistItem.Files(files->Array.append([ChecklistItem.makeFile(id, filename)])))
}
let removeFile = (updateResultCB, files, id) =>
updateResultCB(
- ChecklistItem.Files(files |> Js.Array.filter(a => a |> ChecklistItem.fileId != id)),
+ ChecklistItem.Files(files->Js.Array.filter(a => a->ChecklistItem.fileId != id)),
)
let showFiles = (files, preview, id, attachingCB, updateResultCB) =>
{files
- |> Array.map(file =>
+ ->Array.map(file =>
ChecklistItem.fileId)}
- ariaLabel={"file-" ++ (file |> ChecklistItem.filename)}
+ key={"file-" ++ (file->ChecklistItem.fileId)}
+ ariaLabel={"file-" ++ (file->ChecklistItem.filename)}
target="_blank"
className="w-1/3 pr-2 pb-2">
- {file |> ChecklistItem.filename |> str}
+ {file->ChecklistItem.filename->str}
ChecklistItem.filename)}
+ title={"Remove " ++ (file->ChecklistItem.filename)}
className="flex w-8 justify-center items-center p-2 cursor-pointer bg-gray-100 border-l text-gray-700 hover:bg-gray-200 hover:text-gray-900"
- onClick={_ => removeFile(updateResultCB, files, file |> ChecklistItem.fileId)}>
+ onClick={_ => removeFile(updateResultCB, files, file->ChecklistItem.fileId)}>
)
- |> React.array}
+ ->React.array}
- {files |> Array.length < 3
+ {files->Array.length < 3
?
@@ -186,7 +186,7 @@ let make = (~index, ~checklistItem, ~updateResultCB, ~attachingCB, ~preview) =>
{placeholder(id, checklistItem)}
- {switch checklistItem |> ChecklistItem.result {
+ {switch checklistItem->ChecklistItem.result {
| Files(files) => showFiles(files, preview, id, attachingCB, updateResultCB)
| Link(link) => showLink(link, id, updateResultCB)
| ShortText(shortText) => showShortText(shortText, id, updateResultCB)
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__SubmissionsAndFeedback.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__SubmissionsAndFeedback.res
index edc02ca29c..297805316f 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__SubmissionsAndFeedback.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__SubmissionsAndFeedback.res
@@ -6,18 +6,18 @@ open CoursesCurriculum__Types
let gradeBar = (evaluationCriteria, grade) => {
let criterion =
- evaluationCriteria |> ListUtils.findOpt(c =>
- c |> EvaluationCriterion.id == (grade |> Grade.evaluationCriterionId)
+ evaluationCriteria->ListUtils.findOpt(c =>
+ c->EvaluationCriterion.id == (grade->Grade.evaluationCriterionId)
)
switch criterion {
| Some(criterion) =>
- let criterionId = criterion |> EvaluationCriterion.id
- let criterionName = criterion |> EvaluationCriterion.name
- let gradeNumber = grade |> Grade.grade
+ let criterionId = criterion->EvaluationCriterion.id
+ let criterionName = criterion->EvaluationCriterion.name
+ let gradeNumber = grade->Grade.grade
let grading = Grading.make(~criterionId, ~criterionName, ~grade=gradeNumber)
-
string_of_int} className="mb-4">
+
string_of_int} className="mb-4">
| None => React.null
@@ -41,7 +41,7 @@ let statusBar = (~color, ~text) => {
className={"font-semibold p-2 py-4 flex border-t w-full items-center justify-center " ++
(textColor ++
bgColor)}>
-
icon {text |> str}
+
icon {text->str}
}
@@ -58,13 +58,13 @@ let submissionStatusIcon = (~passed) => {
:
}
-
{text |> str}
+
{text->str}
}
let undoSubmissionCB = () => {
open Webapi.Dom
- location |> Location.reload
+ location->Location.reload
}
let gradingSection = (~grades, ~evaluationCriteria, ~gradeBar, ~passed) =>
@@ -77,20 +77,20 @@ let gradingSection = (~grades, ~evaluationCriteria, ~gradeBar, ~passed) =>
{submissionStatusIcon(~passed)}
-
{"Grading" |> str}
+
{"Grading"->str}
{grades
- |> Grade.sort(evaluationCriteria)
- |> List.map(grade => gradeBar(grade))
- |> Array.of_list
- |> React.array}
+ ->Grade.sort(evaluationCriteria)
+ ->List.map(grade => gradeBar(grade))
+ ->Array.of_list
+ ->React.array}
let handleAddAnotherSubmission = (setShowSubmissionForm, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
setShowSubmissionForm(showSubmissionForm => !showSubmissionForm)
}
@@ -98,33 +98,33 @@ let submissions = (target, targetStatus, targetDetails, evaluationCriteria, coac
let curriedGradeBar = gradeBar(evaluationCriteria)
targetDetails
- |> TargetDetails.submissions
- |> List.sort((s1, s2) => {
- let s1CreatedAt = s1 |> Submission.createdAtDate
- let s2CreatedAt = s2 |> Submission.createdAtDate
+ ->TargetDetails.submissions
+ ->List.sort((s1, s2) => {
+ let s1CreatedAt = s1->Submission.createdAtDate
+ let s2CreatedAt = s2->Submission.createdAtDate
- s1CreatedAt |> DateFns.differenceInSeconds(s2CreatedAt) |> int_of_float
+ s1CreatedAt->DateFns.differenceInSeconds(s2CreatedAt)->int_of_float
})
- |> List.map(submission => {
- let grades = targetDetails |> TargetDetails.grades(submission |> Submission.id)
+ ->List.map(submission => {
+ let grades = targetDetails->TargetDetails.grades(submission->Submission.id)
Submission.id}
+ key={submission->Submission.id}
className="mt-4 pb-4 relative curriculum__submission-feedback-container"
- ariaLabel={"Details about your submission on " ++ (submission |> Submission.createdAtPretty)}>
+ ariaLabel={"Details about your submission on " ++ (submission->Submission.createdAtPretty)}>
- {"Submitted on " ++ (submission |> Submission.createdAtPretty) |> str}
+ {"Submitted on " ++ (submission->Submission.createdAtPretty)->str}
Submission.checklist}
+ checklist={submission->Submission.checklist}
updateChecklistCB=None
- pending={submission |> Submission.pending}
+ pending={submission->Submission.pending}
/>
- {switch submission |> Submission.status {
+ {switch submission->Submission.status {
| MarkedAsComplete => statusBar(~color="green", ~text="Marked as complete")
| Pending =>
- {"Review pending" |> str}
+ {"Review pending"->str}
- {switch targetStatus |> TargetStatus.status {
+ {switch targetStatus->TargetStatus.status {
| Submitted =>
-
Target.id} />
+ Target.id} />
| Pending
| Passed
@@ -153,25 +153,25 @@ let submissions = (target, targetStatus, targetDetails, evaluationCriteria, coac
gradingSection(~grades, ~evaluationCriteria, ~passed=false, ~gradeBar=curriedGradeBar)
}}
{targetDetails
- |> TargetDetails.feedback
- |> List.filter(feedback =>
- feedback |> Feedback.submissionId == (submission |> Submission.id)
+ ->TargetDetails.feedback
+ ->List.filter(feedback =>
+ feedback->Feedback.submissionId == (submission->Submission.id)
)
- |> List.map(feedback => {
+ ->List.map(feedback => {
let coach =
- coaches |> ListUtils.findOpt(c => c |> Coach.id == (feedback |> Feedback.coachId))
+ coaches->ListUtils.findOpt(c => c->Coach.id == (feedback->Feedback.coachId))
let user = switch coach {
| Some(coach) =>
- users |> ListUtils.findOpt(up => up |> User.id == (coach |> Coach.userId))
+ users->ListUtils.findOpt(up => up->User.id == (coach->Coach.userId))
| None => None
}
let (coachName, coachTitle, coachAvatar) = switch user {
| Some(user) =>
- let name = user |> User.name
- let avatar = user |> User.avatarUrl
- let title = user |> User.title
+ let name = user->User.name
+ let avatar = user->User.avatarUrl
+ let title = user->User.title
(name, title,
)
| None => (
"Unknown Coach",
@@ -183,24 +183,24 @@ let submissions = (target, targetStatus, targetDetails, evaluationCriteria, coac
)
}
- Feedback.id}>
+
Feedback.id}>
coachAvatar
-
{"Feedback from:" |> str}
+
{"Feedback from:"->str}
- {coachName |> str}
+ {coachName->str}
{switch coachTitle {
| Some(title) =>
- {"(" ++ (title ++ ")") |> str}
+ {"(" ++ (title ++ ")")->str}
| None => React.null
}}
@@ -210,17 +210,17 @@ let submissions = (target, targetStatus, targetDetails, evaluationCriteria, coac
Feedback.feedback}
+ markdown={feedback->Feedback.feedback}
/>
})
- |> Array.of_list
- |> React.array}
+ ->Array.of_list
+ ->React.array}
})
- |> Array.of_list
- |> React.array
+ ->Array.of_list
+ ->React.array
}
let addSubmission = (setShowSubmissionForm, addSubmissionCB, submission) => {
@@ -244,22 +244,22 @@ let make = (
-
{"Your Submissions" |> str}
- {targetStatus |> TargetStatus.canSubmit(~resubmittable=target |> Target.resubmittable)
+
{"Your Submissions"->str}
+ {targetStatus->TargetStatus.canSubmit(~resubmittable=target->Target.resubmittable)
? showSubmissionForm
?
- {"Cancel" |> str}
- {"Cancel" |> str}
+ {"Cancel"->str}
+ {"Cancel"->str}
:
- {"Add another submission" |> str}
- {"Add another" |> str}
+ {"Add another submission"->str}
+ {"Add another"->str}
: React.null}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Target.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Target.res
index 98ea4e6adb..56c437e3bf 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Target.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Target.res
@@ -18,18 +18,18 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- role: switch json |> field("role", string) {
+ id: json->field("id", string),
+ role: switch json->field("role", string) {
| "student" => Student
| "team" => Team
| unknownRole => raise(CannotParseUnknownRole(unknownRole))
},
- title: json |> field("title", string),
- targetGroupId: json |> field("targetGroupId", string),
- sortIndex: json |> field("sortIndex", int),
- resubmittable: json |> field("resubmittable", bool),
- prerequisiteTargetIds: json |> field("prerequisiteTargetIds", list(string)),
- reviewed: json |> field("reviewed", bool),
+ title: json->field("title", string),
+ targetGroupId: json->field("targetGroupId", string),
+ sortIndex: json->field("sortIndex", int),
+ resubmittable: json->field("resubmittable", bool),
+ prerequisiteTargetIds: json->field("prerequisiteTargetIds", list(string)),
+ reviewed: json->field("reviewed", bool),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetDetails.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetDetails.res
index 030354fc6f..0a7f711619 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetDetails.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetDetails.res
@@ -34,34 +34,34 @@ type completionType =
let decodeNavigation = json => {
open Json.Decode
{
- previous: json |> optional(field("previous", string)),
- next: json |> optional(field("next", string)),
+ previous: json->optional(field("previous", string)),
+ next: json->optional(field("next", string)),
}
}
let decode = json => {
open Json.Decode
{
- pendingUserIds: json |> field("pendingUserIds", list(string)),
- submissions: json |> field("submissions", list(CoursesCurriculum__Submission.decode)),
- feedback: json |> field("feedback", list(CoursesCurriculum__Feedback.decode)),
- quizQuestions: json |> field("quizQuestions", list(CoursesCurriculum__QuizQuestion.decode)),
- contentBlocks: json |> field("contentBlocks", list(ContentBlock.decode)),
- communities: json |> field("communities", list(CoursesCurriculum__Community.decode)),
- linkToComplete: json |> field("linkToComplete", nullable(string)) |> Js.Null.toOption,
- evaluated: json |> field("evaluated", bool),
- grading: json |> field("grading", list(CoursesCurriculum__Grade.decode)),
+ pendingUserIds: json->field("pendingUserIds", list(string)),
+ submissions: json->field("submissions", list(CoursesCurriculum__Submission.decode)),
+ feedback: json->field("feedback", list(CoursesCurriculum__Feedback.decode)),
+ quizQuestions: json->field("quizQuestions", list(CoursesCurriculum__QuizQuestion.decode)),
+ contentBlocks: json->field("contentBlocks", list(ContentBlock.decode)),
+ communities: json->field("communities", list(CoursesCurriculum__Community.decode)),
+ linkToComplete: json->field("linkToComplete", nullable(string))->Js.Null.toOption,
+ evaluated: json->field("evaluated", bool),
+ grading: json->field("grading", list(CoursesCurriculum__Grade.decode)),
completionInstructions: json
- |> field("completionInstructions", nullable(string))
- |> Js.Null.toOption,
- navigation: json |> field("navigation", decodeNavigation),
- checklist: json |> field("checklist", array(TargetChecklistItem.decode)),
+ ->field("completionInstructions", nullable(string))
+ ->Js.Null.toOption,
+ navigation: json->field("navigation", decodeNavigation),
+ checklist: json->field("checklist", array(TargetChecklistItem.decode)),
}
}
let computeCompletionType = targetDetails => {
let evaluated = targetDetails.evaluated
- let hasQuiz = targetDetails.quizQuestions |> ListUtils.isNotEmpty
+ let hasQuiz = targetDetails.quizQuestions->ListUtils.isNotEmpty
let hasLinkToComplete = switch targetDetails.linkToComplete {
| Some(_) => true
| None => false
@@ -82,11 +82,11 @@ let linkToComplete = t => t.linkToComplete
let completionInstructions = t => t.completionInstructions
let grades = (submissionId, t) =>
- t.grading |> List.filter(grade => grade |> CoursesCurriculum__Grade.submissionId == submissionId)
+ t.grading->List.filter(grade => grade->CoursesCurriculum__Grade.submissionId == submissionId)
let addSubmission = (submission, t) => {
...t,
- submissions: list{submission, ...t |> submissions},
+ submissions: list{submission, ...t->submissions},
}
let clearPendingUserIds = t => {...t, pendingUserIds: list{}}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetGroup.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetGroup.res
index 929aea5957..e28b57bdd4 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetGroup.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetGroup.res
@@ -10,16 +10,16 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- levelId: json |> field("levelId", string),
- name: json |> field("name", string),
- description: json |> field("description", string),
- sortIndex: json |> field("sortIndex", int),
- milestone: json |> field("milestone", bool),
+ id: json->field("id", string),
+ levelId: json->field("levelId", string),
+ name: json->field("name", string),
+ description: json->field("description", string),
+ sortIndex: json->field("sortIndex", int),
+ milestone: json->field("milestone", bool),
}
}
-let sort = targetGroups => targetGroups |> List.sort((x, y) => x.sortIndex - y.sortIndex)
+let sort = targetGroups => targetGroups->List.sort((x, y) => x.sortIndex - y.sortIndex)
let id = t => t.id
let name = t => t.name
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetStatus.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetStatus.res
index 898f6df079..6ea7abc19e 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetStatus.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__TargetStatus.res
@@ -50,18 +50,18 @@ type cachedTarget = {
let isPast = dateString =>
switch dateString {
- | Some(date) => date |> DateFns.parseString |> DateFns.isBefore(Js.Date.make())
+ | Some(date) => date->DateFns.parseString->DateFns.isBefore(Js.Date.make())
| None => false
}
-let makePending = targets => targets |> List.map(t => {targetId: t |> Target.id, status: Pending})
+let makePending = targets => targets->List.map(t => {targetId: t->Target.id, status: Pending})
let lockTargets = (targets, reason) =>
- targets |> List.map(t => {targetId: t |> Target.id, status: Locked(reason)})
+ targets->List.map(t => {targetId: t->Target.id, status: Locked(reason)})
let allTargetsComplete = (targetCache, targetIds) =>
- targetIds |> List.for_all(targetId => {
- let cachedTarget = targetCache |> List.find(ct => ct.targetId == targetId)
+ targetIds->List.for_all(targetId => {
+ let cachedTarget = targetCache->List.find(ct => ct.targetId == targetId)
cachedTarget.submissionStatus == SubmissionPassed
})
@@ -69,37 +69,37 @@ let compute = (preview, team, course, levels, targetGroups, targets, submissions
/* Eliminate the two course ended and student access ended conditions. */
if preview {
makePending(targets)
- } else if course |> Course.endsAt |> isPast {
+ } else if course->Course.endsAt->isPast {
lockTargets(targets, CourseLocked)
- } else if team |> Team.accessEndsAt |> isPast {
+ } else if team->Team.accessEndsAt->isPast {
lockTargets(targets, AccessLocked)
} else {
/* Cache level number of the student. */
let studentLevelNumber =
- levels |> List.find(l => l |> Level.id == (team |> Team.levelId)) |> Level.number
+ levels->List.find(l => l->Level.id == (team->Team.levelId))->Level.number
/* Cache level number, milestone boolean, and submission status for all targets. */
- let targetsCache = targets |> List.map(target => {
- let targetId = target |> Target.id
+ let targetsCache = targets->List.map(target => {
+ let targetId = target->Target.id
let targetGroup =
- targetGroups |> List.find(tg => tg |> TargetGroup.id == (target |> Target.targetGroupId))
+ targetGroups->List.find(tg => tg->TargetGroup.id == (target->Target.targetGroupId))
- let milestone = targetGroup |> TargetGroup.milestone
+ let milestone = targetGroup->TargetGroup.milestone
let levelNumber =
levels
- |> List.find(l => l |> Level.id == (targetGroup |> TargetGroup.levelId))
- |> Level.number
+ ->List.find(l => l->Level.id == (targetGroup->TargetGroup.levelId))
+ ->Level.number
let submission =
- submissions |> ListUtils.findOpt(s => s |> LatestSubmission.targetId == targetId)
+ submissions->ListUtils.findOpt(s => s->LatestSubmission.targetId == targetId)
let submissionStatus = switch submission {
| Some(s) =>
- if s |> LatestSubmission.hasPassed {
+ if s->LatestSubmission.hasPassed {
SubmissionPassed
- } else if s |> LatestSubmission.hasBeenEvaluated {
+ } else if s->LatestSubmission.hasBeenEvaluated {
SubmissionFailed
} else {
SubmissionPendingReview
@@ -109,16 +109,16 @@ let compute = (preview, team, course, levels, targetGroups, targets, submissions
{
targetId: targetId,
- targetReviewed: target |> Target.reviewed,
+ targetReviewed: target->Target.reviewed,
levelNumber: levelNumber,
milestone: milestone,
submissionStatus: submissionStatus,
- prerequisiteTargetIds: target |> Target.prerequisiteTargetIds,
+ prerequisiteTargetIds: target->Target.prerequisiteTargetIds,
}
})
/* Scan the targets cache again to form final list of target statuses. */
- targetsCache |> List.map(ct => {
+ targetsCache->List.map(ct => {
let status = switch ct.submissionStatus {
| SubmissionPendingReview => Submitted
| SubmissionPassed => Passed
@@ -126,7 +126,7 @@ let compute = (preview, team, course, levels, targetGroups, targets, submissions
| SubmissionMissing =>
if ct.levelNumber > studentLevelNumber && ct.targetReviewed {
Locked(LevelLocked)
- } else if !(ct.prerequisiteTargetIds |> allTargetsComplete(targetsCache)) {
+ } else if !(ct.prerequisiteTargetIds->allTargetsComplete(targetsCache)) {
Locked(PrerequisitesIncomplete)
} else {
Pending
@@ -171,7 +171,7 @@ let currentLevelStatuses = list{Submitted, Passed}
let lastLevelStatuses = list{Passed}
let matchesStatuses = (statuses, ts) => {
- let matchedTargetStatuses = ts |> List.filter(t => t.status->List.mem(statuses))
+ let matchedTargetStatuses = ts->List.filter(t => t.status->List.mem(statuses))
ts == matchedTargetStatuses
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Team.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Team.res
index 961537cac6..0d0b117d01 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Team.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__Team.res
@@ -8,9 +8,9 @@ type t = {
let decode = json => {
open Json.Decode
{
- name: json |> field("name", string),
- levelId: json |> field("levelId", string),
- accessEndsAt: json |> field("accessEndsAt", nullable(string)) |> Js.Null.toOption,
+ name: json->field("name", string),
+ levelId: json->field("levelId", string),
+ accessEndsAt: json->field("accessEndsAt", nullable(string))->Js.Null.toOption,
}
}
@@ -19,6 +19,6 @@ let accessEndsAt = t => t.accessEndsAt
let accessEnded = t =>
switch t.accessEndsAt {
- | Some(date) => date |> DateFns.parseString |> DateFns.isPast
+ | Some(date) => date->DateFns.parseString->DateFns.isPast
| None => false
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__UndoButton.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__UndoButton.res
index 174496805a..44f554535d 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__UndoButton.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__UndoButton.res
@@ -14,17 +14,17 @@ type status =
| Errored
let handleClick = (targetId, setStatus, undoSubmissionCB, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
if {
open Webapi.Dom
- window |> Window.confirm("Are you sure you want to delete this submission?")
+ window->Window.confirm("Are you sure you want to delete this submission?")
} {
setStatus(_ => Undoing)
DeleteSubmissionQuery.make(~targetId, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
if response["undoSubmission"]["success"] {
undoSubmissionCB()
} else {
@@ -36,7 +36,7 @@ let handleClick = (targetId, setStatus, undoSubmissionCB, event) => {
}
Js.Promise.resolve()
})
- |> Js.Promise.catch(_ => {
+ ->Js.Promise.catch(_ => {
Notification.error(
"Unexpected Error",
"An unexpected error occured, and our team has been notified about this. Please reload the page before trying again.",
@@ -44,7 +44,7 @@ let handleClick = (targetId, setStatus, undoSubmissionCB, event) => {
setStatus(_ => Errored)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
} else {
()
}
@@ -52,15 +52,15 @@ let handleClick = (targetId, setStatus, undoSubmissionCB, event) => {
let buttonContents = status =>
switch status {
- | Undoing =>
{"Undoing..." |> str}
+ | Undoing =>
{"Undoing..."->str}
| Pending =>
- {"Undo submission" |> str}
- {"Undo" |> str}
+ {"Undo submission"->str}
+ {"Undo"->str}
| Errored =>
-
{"Error!" |> str}
+
{"Error!"->str}
}
let isDisabled = status =>
@@ -86,7 +86,7 @@ let make = (~undoSubmissionCB, ~targetId) => {
let (status, setStatus) = React.useState(() => Pending)
isDisabled}
+ disabled={status->isDisabled}
className={buttonClasses(status)}
onClick={handleClick(targetId, setStatus, undoSubmissionCB)}>
{buttonContents(status)}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__UrlForm.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__UrlForm.res
index da531fa4da..0d46a4646a 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__UrlForm.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__UrlForm.res
@@ -12,9 +12,9 @@ type action =
| ResetForm
let validate = url => {
- let urlLength = url |> String.length
+ let urlLength = url->String.length
- if url |> UrlUtils.isInvalid(false) && urlLength > 0 {
+ if url->UrlUtils.isInvalid(false) && urlLength > 0 {
list{"does not look like a valid URL"}
} else {
list{}
@@ -28,19 +28,19 @@ let reducer = (_state, action) =>
}
let updateUrl = (send, typingCB, event) => {
- let value = ReactEvent.Form.target(event)["value"] |> Js.String.trim
- typingCB(value |> String.length > 0)
+ let value = ReactEvent.Form.target(event)["value"]->Js.String.trim
+ typingCB(value->String.length > 0)
send(UpdateUrl(value))
}
let isDisabled = state =>
switch state.url {
| "" => true
- | _someUrl => state.errors |> ListUtils.isNotEmpty
+ | _someUrl => state.errors->ListUtils.isNotEmpty
}
let attachUrl = (state, send, attachUrlCB, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
!isDisabled(state) ? attachUrlCB(state.url) : ()
send(ResetForm)
}
@@ -63,16 +63,16 @@ let make = (~attachUrlCB, ~typingCB) => {
onClick={attachUrl(state, send, attachUrlCB)}
disabled={isDisabled(state)}
className="mt-2 bg-indigo-600 hover:bg-gray-500 text-white text-sm font-semibold py-2 px-6 focus:outline-none">
- {"Attach link" |> str}
+ {"Attach link"->str}
{state.errors
- |> List.map(error =>
+ ->List.map(error =>
- {error |> str}
+ {error->str}
)
- |> Array.of_list
- |> React.array}
+ ->Array.of_list
+ ->React.array}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__User.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__User.res
index 12df38f27b..d5dd8405b6 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__User.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesCurriculum__User.res
@@ -13,9 +13,9 @@ let title = t => t.title
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- name: json |> field("name", string),
- avatarUrl: json |> field("avatarUrl", string),
- title: json |> field("title", nullable(string)) |> Js.Null.toOption,
+ id: json->field("id", string),
+ name: json->field("name", string),
+ avatarUrl: json->field("avatarUrl", string),
+ title: json->field("title", nullable(string))->Js.Null.toOption,
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Checklist.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Checklist.res
index c842587e46..befea45e55 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Checklist.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Checklist.res
@@ -26,10 +26,10 @@ let handleEmpty = setState =>
- {"Create a review checklist" |> str}
+ {"Create a review checklist"->str}
- {"Prepare for your review by creating a checklist" |> str}
+ {"Prepare for your review by creating a checklist"->str}
@@ -49,7 +49,7 @@ let make = (
-
{"Review Checklist" |> str}
+
{"Review Checklist"->str}
@@ -62,7 +62,7 @@ let make = (
targetId
/>
| Show =>
- reviewChecklist |> ArrayUtils.isEmpty
+ reviewChecklist->ArrayUtils.isEmpty
? handleEmpty(setState)
:
{
setState(state => {...state, saving: true})
- let trimmedChecklist = reviewChecklist |> Array.map(ReviewChecklistItem.trim)
+ let trimmedChecklist = reviewChecklist->Array.map(ReviewChecklistItem.trim)
UpdateReviewChecklistMutation.make(
~targetId,
~reviewChecklist=ReviewChecklistItem.encodeArray(trimmedChecklist),
(),
)
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
if response["updateReviewChecklist"]["success"] {
updateReviewChecklistCB(trimmedChecklist)
}
@@ -36,13 +36,13 @@ let updateReviewChecklist = (targetId, reviewChecklist, setState, updateReviewCh
setState(state => {...state, saving: false})
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let updateChecklistItem = (checklistItem, itemIndex, setState) =>
setState(state => {
...state,
- reviewChecklist: state.reviewChecklist |> ReviewChecklistItem.replace(checklistItem, itemIndex),
+ reviewChecklist: state.reviewChecklist->ReviewChecklistItem.replace(checklistItem, itemIndex),
})
let updateChecklistItemTitle = (itemIndex, title, checklistItem, setState) =>
@@ -57,10 +57,10 @@ let updateChecklistResultTitle = (
setState,
) => {
let newReviewChecklistItem =
- reviewChecklistItem |> ReviewChecklistItem.updateChecklist(
+ reviewChecklistItem->ReviewChecklistItem.updateChecklist(
reviewChecklistItem
- |> ReviewChecklistItem.result
- |> ReviewChecklistResult.updateTitle(title, resultItem, resultIndex),
+ ->ReviewChecklistItem.result
+ ->ReviewChecklistResult.updateTitle(title, resultItem, resultIndex),
)
updateChecklistItem(newReviewChecklistItem, itemIndex, setState)
}
@@ -74,17 +74,17 @@ let updateChecklistResultFeedback = (
setState,
) => {
let newReviewChecklistItem =
- reviewChecklistItem |> ReviewChecklistItem.updateChecklist(
+ reviewChecklistItem->ReviewChecklistItem.updateChecklist(
reviewChecklistItem
- |> ReviewChecklistItem.result
- |> ReviewChecklistResult.updateFeedback(feedback, resultItem, resultIndex),
+ ->ReviewChecklistItem.result
+ ->ReviewChecklistResult.updateFeedback(feedback, resultItem, resultIndex),
)
updateChecklistItem(newReviewChecklistItem, itemIndex, setState)
}
let addEmptyResultItem = (reviewChecklistItem, itemIndex, setState) =>
updateChecklistItem(
- reviewChecklistItem |> ReviewChecklistItem.appendEmptyChecklistItem,
+ reviewChecklistItem->ReviewChecklistItem.appendEmptyChecklistItem,
itemIndex,
setState,
)
@@ -92,12 +92,12 @@ let addEmptyResultItem = (reviewChecklistItem, itemIndex, setState) =>
let addEmptyChecklistItem = setState =>
setState(state => {
...state,
- reviewChecklist: ReviewChecklistItem.empty() |> Array.append(state.reviewChecklist),
+ reviewChecklist: ReviewChecklistItem.empty()->Array.append(state.reviewChecklist),
})
let removeChecklistResult = (itemIndex, resultIndex, reviewChecklistItem, setState) =>
updateChecklistItem(
- reviewChecklistItem |> ReviewChecklistItem.deleteResultItem(resultIndex),
+ reviewChecklistItem->ReviewChecklistItem.deleteResultItem(resultIndex),
itemIndex,
setState,
)
@@ -105,41 +105,41 @@ let removeChecklistResult = (itemIndex, resultIndex, reviewChecklistItem, setSta
let removeChecklistItem = (itemIndex, setState) =>
setState(state => {
...state,
- reviewChecklist: state.reviewChecklist |> Js.Array.filteri((_el, i) => i != itemIndex),
+ reviewChecklist: state.reviewChecklist->Js.Array.filteri((_el, i) => i != itemIndex),
})
let initialStateForReviewChecklist = reviewChecklist =>
- reviewChecklist |> ArrayUtils.isEmpty ? ReviewChecklistItem.emptyTemplate() : reviewChecklist
+ reviewChecklist->ArrayUtils.isEmpty ? ReviewChecklistItem.emptyTemplate() : reviewChecklist
-let invalidTitle = title => title |> String.trim == ""
+let invalidTitle = title => title->String.trim == ""
let invalidChecklist = reviewChecklist =>
reviewChecklist
- |> Array.map(reviewChecklistItem =>
- reviewChecklistItem |> ReviewChecklistItem.title |> invalidTitle ||
+ ->Array.map(reviewChecklistItem =>
+ reviewChecklistItem->ReviewChecklistItem.title->invalidTitle ||
reviewChecklistItem
- |> ReviewChecklistItem.result
- |> Js.Array.filter(resultItem => resultItem |> ReviewChecklistResult.title |> invalidTitle)
- |> ArrayUtils.isNotEmpty
+ ->ReviewChecklistItem.result
+ ->Js.Array.filter(resultItem => resultItem->ReviewChecklistResult.title->invalidTitle)
+ ->ArrayUtils.isNotEmpty
)
- |> Js.Array.filter(valid => valid)
- |> ArrayUtils.isNotEmpty
+ ->Js.Array.filter(valid => valid)
+ ->ArrayUtils.isNotEmpty
@react.component
let make = (~reviewChecklist, ~updateReviewChecklistCB, ~closeEditModeCB, ~targetId) => {
let (state, setState) = React.useState(() => {
- reviewChecklist: reviewChecklist |> initialStateForReviewChecklist,
+ reviewChecklist: reviewChecklist->initialStateForReviewChecklist,
saving: false,
})
{state.reviewChecklist
- |> Array.mapi((itemIndex, reviewChecklistItem) =>
+ ->Array.mapi((itemIndex, reviewChecklistItem) =>
string_of_int}
- ariaLabel={"checklist-item-" ++ (itemIndex |> string_of_int)}>
+ key={itemIndex->string_of_int}
+ ariaLabel={"checklist-item-" ++ (itemIndex->string_of_int)}>
ReviewChecklistItem.title}
+ value={reviewChecklistItem->ReviewChecklistItem.title}
onChange={event =>
updateChecklistItemTitle(
itemIndex,
@@ -158,7 +158,7 @@ let make = (~reviewChecklist, ~updateReviewChecklistCB, ~closeEditModeCB, ~targe
/>
ReviewChecklistItem.title |> invalidTitle}
+ active={reviewChecklistItem->ReviewChecklistItem.title->invalidTitle}
/>
{reviewChecklistItem
- |> ReviewChecklistItem.result
- |> Array.mapi((resultIndex, resultItem) => {
- let feedback = switch resultItem |> ReviewChecklistResult.feedback {
+ ->ReviewChecklistItem.result
+ ->Array.mapi((resultIndex, resultItem) => {
+ let feedback = switch resultItem->ReviewChecklistResult.feedback {
| Some(f) => f
| None => ""
}
string_of_int)}
+ ariaLabel={"result-item-" ++ (resultIndex->string_of_int)}
className="pl-2 md:pl-4 mt-2"
- key={(itemIndex |> string_of_int) ++ (resultIndex |> string_of_int)}>
+ key={(itemIndex->string_of_int) ++ (resultIndex->string_of_int)}>
})
- |> React.array}
+ ->React.array}
addEmptyResultItem(reviewChecklistItem, itemIndex, setState)}
className="checklist-editor__add-result-btn ml-2 md:ml-4 mt-3 flex items-center focus:outline-none">
@@ -255,19 +255,19 @@ let make = (~reviewChecklist, ~updateReviewChecklistCB, ~closeEditModeCB, ~targe
/>
- {"Add Result" |> str}
+ {"Add Result"->str}
)
- |> React.array}
+ ->React.array}
addEmptyChecklistItem(setState)}>
- {"Add Checklist Item" |> str}
+ {"Add Checklist Item"->str}
@@ -281,10 +281,10 @@ let make = (~reviewChecklist, ~updateReviewChecklistCB, ~closeEditModeCB, ~targe
updateReviewChecklistCB,
)}
className="btn btn-success w-1/2 md:w-auto">
- {"Save Checklist" |> str}
+ {"Save Checklist"->str}
closeEditModeCB()}>
- {"Cancel" |> str}
+ {"Cancel"->str}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ChecklistShow.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ChecklistShow.res
index 749a0fba04..9ddde9956a 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ChecklistShow.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ChecklistShow.res
@@ -11,12 +11,12 @@ let str = React.string
let selectChecklist = (itemIndex, resultIndex, setSelecton) =>
setSelecton(selection =>
- selection |> List.append(list{{itemIndex: itemIndex, resultIndex: resultIndex}})
+ selection->List.append(list{{itemIndex: itemIndex, resultIndex: resultIndex}})
)
let unSelectChecklist = (itemIndex, resultIndex, setSelecton) =>
setSelecton(selection =>
- selection |> List.filter(item =>
+ selection->List.filter(item =>
!(item.itemIndex == itemIndex && item.resultIndex == resultIndex)
)
)
@@ -31,42 +31,42 @@ let generateFeedback = (reviewChecklist, selection, feedback, updateFeedbackCB)
feedback ++
("\n\n" ++
(reviewChecklist
- |> Array.mapi((i, reviewChecklistItem) => {
+ ->Array.mapi((i, reviewChecklistItem) => {
let resultIndexList =
selection
- |> List.filter(selectionItem => selectionItem.itemIndex == i)
- |> List.map(item => item.resultIndex)
+ ->List.filter(selectionItem => selectionItem.itemIndex == i)
+ ->List.map(item => item.resultIndex)
reviewChecklistItem
- |> ReviewChecklistItem.result
- |> Array.mapi((index, resultItem) =>
- resultIndexList |> List.mem(index)
- ? switch resultItem |> ReviewChecklistResult.feedback {
+ ->ReviewChecklistItem.result
+ ->Array.mapi((index, resultItem) =>
+ resultIndexList->List.mem(index)
+ ? switch resultItem->ReviewChecklistResult.feedback {
| Some(feedback) => list{feedback}
| None => list{}
}
: list{}
)
- |> Array.to_list
- |> List.flatten
+ ->Array.to_list
+ ->List.flatten
})
- |> Array.to_list
- |> List.flatten
- |> Array.of_list
- |> Js.Array.joinWith("\n\n")))
+ ->Array.to_list
+ ->List.flatten
+ ->Array.of_list
+ ->Js.Array.joinWith("\n\n")))
updateFeedbackCB(newFeedback)
}
let checklistItemCheckedClasses = (itemIndex, selection) =>
"mb-4 px-2 pb-2 md:px-4 border-l-2 border-transparent " ++ (
- selection |> List.filter(s => s.itemIndex == itemIndex) |> ListUtils.isNotEmpty
+ selection->List.filter(s => s.itemIndex == itemIndex)->ListUtils.isNotEmpty
? "border-green-400"
: ""
)
let checklistItemChecked = (itemIndex, resultIndex, selection) =>
selection
- |> List.filter(s => s.itemIndex == itemIndex && s.resultIndex == resultIndex)
- |> ListUtils.isNotEmpty
+ ->List.filter(s => s.itemIndex == itemIndex && s.resultIndex == resultIndex)
+ ->ListUtils.isNotEmpty
@react.component
let make = (~reviewChecklist, ~feedback, ~updateFeedbackCB, ~showEditorCB) => {
@@ -78,50 +78,50 @@ let make = (~reviewChecklist, ~feedback, ~updateFeedbackCB, ~showEditorCB) => {
showEditorCB()}>
- {"Edit Checklist" |> str}
+ {"Edit Checklist"->str}
{reviewChecklist
- |> Array.mapi((itemIndex, reviewChecklistItem) =>
+ ->Array.mapi((itemIndex, reviewChecklistItem) =>
string_of_int}
- ariaLabel={"checklist-item-" ++ (itemIndex |> string_of_int)}>
+ key={itemIndex->string_of_int}
+ ariaLabel={"checklist-item-" ++ (itemIndex->string_of_int)}>
- {reviewChecklistItem |> ReviewChecklistItem.title |> str}
+ {reviewChecklistItem->ReviewChecklistItem.title->str}
{reviewChecklistItem
- |> ReviewChecklistItem.result
- |> Array.mapi((resultIndex, checklistItem) =>
+ ->ReviewChecklistItem.result
+ ->Array.mapi((resultIndex, checklistItem) =>
string_of_int)}
- key={(itemIndex |> string_of_int) ++ (resultIndex |> string_of_int)}>
+ ariaLabel={"result-item-" ++ (resultIndex->string_of_int)}
+ key={(itemIndex->string_of_int) ++ (resultIndex->string_of_int)}>
string_of_int) ++ (resultIndex |> string_of_int))}
- label={checklistItem |> ReviewChecklistResult.title}
+ id={id ++ ((itemIndex->string_of_int) ++ (resultIndex->string_of_int))}
+ label={checklistItem->ReviewChecklistResult.title}
onChange={checkboxOnChange(itemIndex, resultIndex, setSelecton)}
checked={checklistItemChecked(itemIndex, resultIndex, selection)}
/>
ReviewChecklistResult.feedback}
+ feedback={checklistItem->ReviewChecklistResult.feedback}
/>
)
- |> React.array}
+ ->React.array}
)
- |> React.array}
+ ->React.array}
ListUtils.isEmpty}
+ disabled={selection->ListUtils.isEmpty}
onClick={_ => generateFeedback(reviewChecklist, selection, feedback, updateFeedbackCB)}>
- {"Generate Feedback" |> str}
+ {"Generate Feedback"->str}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ChecklistShowFeedback.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ChecklistShowFeedback.res
index c59b688a14..a0a1bfad77 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ChecklistShowFeedback.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ChecklistShowFeedback.res
@@ -6,13 +6,13 @@ let feedbackClasses = truncated => truncated ? "relative overflow-hidden h-12" :
let optionalStringLength = feedback =>
switch feedback {
- | Some(f) => f |> String.length
+ | Some(f) => f->String.length
| None => 0
}
@react.component
let make = (~feedback) => {
- let truncationRequired = feedback |> optionalStringLength > 150
+ let truncationRequired = feedback->optionalStringLength > 150
let (truncated, setTruncated) = React.useState(() => truncationRequired)
@@ -25,7 +25,7 @@ let make = (~feedback) => {
setTruncated(_ => false)}>
- {"Show All" |> str}
+ {"Show All"->str}
: React.null}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Feedback.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Feedback.res
index 49cdce1fab..b2ced1070a 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Feedback.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Feedback.res
@@ -9,7 +9,7 @@ let value = t => t.value
let coachName = t => t.coachName
let coachAvatarUrl = t => t.coachAvatarUrl
let coachTitle = t => t.coachTitle
-let createdAtPretty = t => t.createdAt |> DateFns.format("MMMM D, YYYY")
+let createdAtPretty = t => t.createdAt->DateFns.format("MMMM D, YYYY")
let make = (~coachName, ~coachAvatarUrl, ~coachTitle, ~createdAt, ~value) => {
coachName: coachName,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__FeedbackEditor.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__FeedbackEditor.res
index c8d671fb53..8713d5eecb 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__FeedbackEditor.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__FeedbackEditor.res
@@ -11,7 +11,7 @@ let make = (
~targetId,
) => {
let (checklistVisible, setChecklistVisible) = React.useState(() => checklistVisible)
- let reviewChecklistIsNotEmpty = reviewChecklist |> ArrayUtils.isNotEmpty
+ let reviewChecklistIsNotEmpty = reviewChecklist->ArrayUtils.isNotEmpty
{switch (checklistVisible, reviewChecklistIsNotEmpty) {
@@ -30,7 +30,7 @@ let make = (
className="inline-flex w-10 h-10 border border-white items-center justify-center rounded-full bg-primary-100 text-primary-500">
- {"Show Review Checklist" |> str}
+ {"Show Review Checklist"->str}
}}
@@ -40,7 +40,7 @@ let make = (
-
{label |> str}
+
{label->str}
{
}
let sort = (criteria, grades) =>
- grades |> ArrayUtils.copyAndSort((g1, g2) => {
+ grades->ArrayUtils.copyAndSort((g1, g2) => {
let ec1 =
- criteria |> ArrayUtils.unsafeFind(
+ criteria->ArrayUtils.unsafeFind(
ec => EvaluationCriterion.id(ec) == g1.evaluationCriterionId,
"Unable to find evaluation criterion with ID: " ++
(g1.evaluationCriterionId ++
" in CoursesReview__Grade"),
)
let ec2 =
- criteria |> ArrayUtils.unsafeFind(
+ criteria->ArrayUtils.unsafeFind(
ec => EvaluationCriterion.id(ec) == g2.evaluationCriterionId,
"Unable to find evaluation criterion with ID: " ++
(g2.evaluationCriterionId ++
" in CoursesReview__Grade"),
)
- String.compare(ec1 |> EvaluationCriterion.name, ec2 |> EvaluationCriterion.name)
+ String.compare(ec1->EvaluationCriterion.name, ec2->EvaluationCriterion.name)
})
let evaluationCriterionId = t => t.evaluationCriterionId
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__GradeCard.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__GradeCard.res
index 9c5f7a9ce6..e11f4cc45f 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__GradeCard.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__GradeCard.res
@@ -36,19 +36,19 @@ let reducer = (state, action) =>
let passed = (grades, evaluationCriteria) =>
grades
- |> Js.Array.filter(g => {
+ ->Js.Array.filter(g => {
let passGrade =
evaluationCriteria
- |> ArrayUtils.unsafeFind(
- ec => EvaluationCriterion.id(ec) == (g |> Grade.evaluationCriterionId),
+ ->ArrayUtils.unsafeFind(
+ ec => EvaluationCriterion.id(ec) == (g->Grade.evaluationCriterionId),
"CoursesReview__GradeCard: Unable to find evaluation criterion with id - " ++
- (g |> Grade.evaluationCriterionId),
+ (g->Grade.evaluationCriterionId),
)
- |> EvaluationCriterion.passGrade
+ ->EvaluationCriterion.passGrade
- g |> Grade.value < passGrade
+ g->Grade.value < passGrade
})
- |> ArrayUtils.isEmpty
+ ->ArrayUtils.isEmpty
module CreateGradingMutation = %graphql(`
mutation CreateGradingMutation($submissionId: ID!, $feedback: String, $grades: [GradeInput!]!, $note: String, $checklist: JSON!) {
@@ -70,28 +70,28 @@ let undoGrading = (submissionId, send) => {
send(BeginSaving)
UndoGradingMutation.make(~submissionId, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
- response["undoGrading"]["success"] ? DomUtils.reload() |> ignore : send(FinishSaving)
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
+ response["undoGrading"]["success"] ? DomUtils.reload()->ignore : send(FinishSaving)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let trimToOption = s =>
- switch s |> String.trim {
+ switch s->String.trim {
| "" => None
| s => Some(s)
}
let gradeSubmissionQuery = (submissionId, state, send, evaluationCriteria, addGradingCB) => {
- let jsGradesArray = state.grades |> Array.map(g => g |> Grade.asJsType)
+ let jsGradesArray = state.grades->Array.map(g => g->Grade.asJsType)
- let checklist = state.checklist |> SubmissionChecklistItem.encodeArray
+ let checklist = state.checklist->SubmissionChecklistItem.encodeArray
send(BeginSaving)
- let feedback = state.newFeedback |> trimToOption
- let note = state.note |> OptionUtils.flatMap(trimToOption)
+ let feedback = state.newFeedback->trimToOption
+ let note = state.note->OptionUtils.flatMap(trimToOption)
CreateGradingMutation.make(
~submissionId,
@@ -101,8 +101,8 @@ let gradeSubmissionQuery = (submissionId, state, send, evaluationCriteria, addGr
~checklist,
(),
)
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
response["createGrading"]["success"]
? addGradingCB(
~newFeedback=state.newFeedback,
@@ -114,22 +114,22 @@ let gradeSubmissionQuery = (submissionId, state, send, evaluationCriteria, addGr
send(FinishSaving)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let updateGrading = (grade, state, send) => {
let newGrades =
state.grades
- |> Js.Array.filter(g =>
- g |> Grade.evaluationCriterionId != (grade |> Grade.evaluationCriterionId)
+ ->Js.Array.filter(g =>
+ g->Grade.evaluationCriterionId != (grade->Grade.evaluationCriterionId)
)
- |> Array.append([grade])
+ ->Array.append([grade])
send(UpdateGrades(newGrades))
}
let handleGradePillClick = (evaluationCriterionId, value, state, send, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
switch send {
| Some(send) => updateGrading(Grade.make(~evaluationCriterionId, ~value), state, send)
| None => ()
@@ -137,8 +137,8 @@ let handleGradePillClick = (evaluationCriterionId, value, state, send, event) =>
}
let findEvaluationCriterion = (evaluationCriteria, evaluationCriterionId) =>
- switch evaluationCriteria |> Js.Array.find(ec =>
- ec |> EvaluationCriterion.id == evaluationCriterionId
+ switch evaluationCriteria->Js.Array.find(ec =>
+ ec->EvaluationCriterion.id == evaluationCriterionId
) {
| Some(ec) => ec
| None =>
@@ -152,11 +152,11 @@ let findEvaluationCriterion = (evaluationCriteria, evaluationCriterionId) =>
let gradePillHeader = (evaluationCriteriaName, selectedGrade, gradeLabels) =>
-
{evaluationCriteriaName |> str}
+
{evaluationCriteriaName->str}
- {(selectedGrade |> string_of_int) ++
+ {(selectedGrade->string_of_int) ++
("/" ++
- (GradeLabel.maxGrade(gradeLabels |> Array.to_list) |> string_of_int)) |> str}
+ (GradeLabel.maxGrade(gradeLabels->Array.to_list)->string_of_int))->str}
@@ -185,81 +185,81 @@ let gradePillClasses = (selectedGrade, currentGrade, passgrade, send) => {
let showGradePill = (key, evaluationCriterion, gradeValue, passGrade, state, send) =>
EvaluationCriterion.id)}
- key={key |> string_of_int}
+ ariaLabel={"evaluation-criterion-" ++ (evaluationCriterion->EvaluationCriterion.id)}
+ key={key->string_of_int}
className="md:pr-8 mt-4">
{gradePillHeader(
- evaluationCriterion |> EvaluationCriterion.name,
+ evaluationCriterion->EvaluationCriterion.name,
gradeValue,
- evaluationCriterion |> EvaluationCriterion.gradesAndLabels,
+ evaluationCriterion->EvaluationCriterion.gradesAndLabels,
)}
{evaluationCriterion
- |> EvaluationCriterion.gradesAndLabels
- |> Array.map(gradeLabel => {
- let gradeLabelGrade = gradeLabel |> GradeLabel.grade
+ ->EvaluationCriterion.gradesAndLabels
+ ->Array.map(gradeLabel => {
+ let gradeLabelGrade = gradeLabel->GradeLabel.grade
string_of_int}
+ key={gradeLabelGrade->string_of_int}
onClick={handleGradePillClick(
- evaluationCriterion |> EvaluationCriterion.id,
+ evaluationCriterion->EvaluationCriterion.id,
gradeLabelGrade,
state,
send,
)}
- title={gradeLabel |> GradeLabel.label}
+ title={gradeLabel->GradeLabel.label}
className={gradePillClasses(gradeValue, gradeLabelGrade, passGrade, send)}>
{switch send {
- | Some(_) => gradeLabelGrade |> string_of_int |> str
+ | Some(_) => gradeLabelGrade->string_of_int->str
| None => React.null
}}
})
- |> React.array}
+ ->React.array}
let showGrades = (grades, evaluationCriteria, state) =>
{grades
- |> Grade.sort(evaluationCriteria)
- |> Array.mapi((key, grade) => {
+ ->Grade.sort(evaluationCriteria)
+ ->Array.mapi((key, grade) => {
let gradeEcId = Grade.evaluationCriterionId(grade)
let ec =
- evaluationCriteria |> ArrayUtils.unsafeFind(
- ec => ec |> EvaluationCriterion.id == gradeEcId,
+ evaluationCriteria->ArrayUtils.unsafeFind(
+ ec => ec->EvaluationCriterion.id == gradeEcId,
"Unable to find evaluation Criterion with id: " ++
(gradeEcId ++
"in CoursesRevew__GradeCard"),
)
- showGradePill(key, ec, grade |> Grade.value, ec |> EvaluationCriterion.passGrade, state, None)
+ showGradePill(key, ec, grade->Grade.value, ec->EvaluationCriterion.passGrade, state, None)
})
- |> React.array}
+ ->React.array}
let renderGradePills = (evaluationCriteria, targetEvaluationCriteriaIds, state, send) =>
targetEvaluationCriteriaIds
- |> Array.mapi((key, evaluationCriterionId) => {
+ ->Array.mapi((key, evaluationCriterionId) => {
let ec =
- evaluationCriteria |> ArrayUtils.unsafeFind(
- e => e |> EvaluationCriterion.id == evaluationCriterionId,
+ evaluationCriteria->ArrayUtils.unsafeFind(
+ e => e->EvaluationCriterion.id == evaluationCriterionId,
"CoursesReview__GradeCard: Unable to find evaluation criterion with id - " ++
evaluationCriterionId,
)
let grade =
- state.grades |> Js.Array.find(g =>
- g |> Grade.evaluationCriterionId == (ec |> EvaluationCriterion.id)
+ state.grades->Js.Array.find(g =>
+ g->Grade.evaluationCriterionId == (ec->EvaluationCriterion.id)
)
let gradeValue = switch grade {
- | Some(g) => g |> Grade.value
+ | Some(g) => g->Grade.value
| None => 0
}
- let passGrade = ec |> EvaluationCriterion.passGrade
+ let passGrade = ec->EvaluationCriterion.passGrade
showGradePill(key, ec, gradeValue, passGrade, state, Some(send))
})
- |> React.array
+ ->React.array
let gradeStatusClasses = (color, status) =>
"w-12 h-10 p-1 mr-2 md:mr-0 md:w-24 md:h-20 rounded md:rounded-lg border flex justify-center items-center bg-" ++
(color ++
@@ -285,22 +285,22 @@ let submissionStatusIcon = (status, overlaySubmission, send) => {
className="flex w-full md:w-3/6 flex-col items-center justify-center md:border-l mt-4 md:mt-0">
- {switch (overlaySubmission |> OverlaySubmission.evaluatedAt, status) {
+ {switch (overlaySubmission->OverlaySubmission.evaluatedAt, status) {
| (Some(date), Graded(_)) =>
-
{"Evaluated By" |> str}
+
{"Evaluated By"->str}
- {switch overlaySubmission |> OverlaySubmission.evaluatorName {
- | Some(name) => name |> str
- | None => {"Deleted Coach" |> str}
+ {switch overlaySubmission->OverlaySubmission.evaluatorName {
+ | Some(name) => name->str
+ | None => {"Deleted Coach"->str}
}}
- {"on " ++ (date |> DateFns.format("MMMM D, YYYY")) |> str}
+ {"on " ++ (date->DateFns.format("MMMM D, YYYY"))->str}
| (None, Graded(_))
@@ -325,17 +325,17 @@ let submissionStatusIcon = (status, overlaySubmission, send) => {
(color ++
("-400 " ++
("bg-" ++ (color ++ ("-100 " ++ ("text-" ++ (color ++ "-800 "))))))))}>
- {text |> str}
+ {text->str}
- {switch (overlaySubmission |> OverlaySubmission.evaluatedAt, status) {
+ {switch (overlaySubmission->OverlaySubmission.evaluatedAt, status) {
| (Some(_), Graded(_)) =>
undoGrading(overlaySubmission |> OverlaySubmission.id, send)}
+ onClick={_ => undoGrading(overlaySubmission->OverlaySubmission.id, send)}
className="btn btn-danger btn-small">
- {"Undo Grading" |> str}
+ {"Undo Grading"->str}
| (None, Graded(_))
@@ -354,7 +354,7 @@ let gradeSubmission = (
status,
event,
) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
switch status {
| Graded(_) => gradeSubmissionQuery(submissionId, state, send, evaluationCriteria, addGradingCB)
| Grading
@@ -385,15 +385,15 @@ let reviewButtonDisabled = status =>
let computeStatus = (overlaySubmission, selectedGrades, evaluationCriteria) =>
switch (
- overlaySubmission |> OverlaySubmission.passedAt,
- overlaySubmission |> OverlaySubmission.grades |> ArrayUtils.isNotEmpty,
+ overlaySubmission->OverlaySubmission.passedAt,
+ overlaySubmission->OverlaySubmission.grades->ArrayUtils.isNotEmpty,
) {
| (Some(_), _) => Graded(true)
| (None, true) => Graded(false)
| (_, _) =>
if selectedGrades == [] {
Ungraded
- } else if selectedGrades |> Array.length != (evaluationCriteria |> Array.length) {
+ } else if selectedGrades->Array.length != (evaluationCriteria->Array.length) {
Grading
} else {
Graded(passed(selectedGrades, evaluationCriteria))
@@ -401,7 +401,7 @@ let computeStatus = (overlaySubmission, selectedGrades, evaluationCriteria) =>
}
let submitButtonText = (feedback, grades) =>
- switch (feedback != "", grades |> ArrayUtils.isNotEmpty) {
+ switch (feedback != "", grades->ArrayUtils.isNotEmpty) {
| (false, false)
| (false, true) => "Save grades"
| (true, false)
@@ -409,7 +409,7 @@ let submitButtonText = (feedback, grades) =>
}
let noteForm = (overlaySubmission, teamSubmission, note, send) =>
- switch overlaySubmission |> OverlaySubmission.grades {
+ switch overlaySubmission->OverlaySubmission.grades {
| [] =>
let (noteAbout, additionalHelp) = teamSubmission
? (
@@ -423,10 +423,10 @@ let noteForm = (overlaySubmission, teamSubmission, note, send) =>
{"Notes can be used to keep track of a " ++
(noteAbout ++
("'s progress. These notes are shown only to coaches in a student's report." ++
- additionalHelp)) |> str}
+ additionalHelp))->str}
- let textareaId = "note-for-submission-" ++ (overlaySubmission |> OverlaySubmission.id)
+ let textareaId = "note-for-submission-" ++ (overlaySubmission->OverlaySubmission.id)
@@ -434,19 +434,19 @@ let noteForm = (overlaySubmission, teamSubmission, note, send) =>
{switch note {
| Some(_) =>
- help
+ help
| None =>
- {"Would you like to write a note about this " ++ (noteAbout ++ "?") |> str}
+ {"Would you like to write a note about this " ++ (noteAbout ++ "?")->str}
help
send(UpdateNote(""))}>
- {"Write a Note" |> str}
+ {"Write a Note"->str}
}}
@@ -487,17 +487,17 @@ let make = (
newFeedback: "",
saving: false,
note: None,
- checklist: overlaySubmission |> OverlaySubmission.checklist,
+ checklist: overlaySubmission->OverlaySubmission.checklist,
},
)
let status = computeStatus(overlaySubmission, state.grades, evaluationCriteria)
- let updateChecklistCB = switch overlaySubmission |> OverlaySubmission.grades {
+ let updateChecklistCB = switch overlaySubmission->OverlaySubmission.grades {
| [] => Some(checklist => send(UpdateChecklist(checklist)))
| _ => None
}
- let pending = overlaySubmission |> OverlaySubmission.grades |> ArrayUtils.isEmpty
+ let pending = overlaySubmission->OverlaySubmission.grades->ArrayUtils.isEmpty
@@ -505,7 +505,7 @@ let make = (
{showFeedbackForm(
- overlaySubmission |> OverlaySubmission.grades,
+ overlaySubmission->OverlaySubmission.grades,
reviewChecklist,
updateReviewChecklistCB,
state,
@@ -516,12 +516,12 @@ let make = (
{noteForm(overlaySubmission, teamSubmission, state.note, send)}
- {"Grade Card" |> str}
+ {"Grade Card"->str}
- {switch overlaySubmission |> OverlaySubmission.grades {
+ {switch overlaySubmission->OverlaySubmission.grades {
| [] => renderGradePills(evaluationCriteria, targetEvaluationCriteriaIds, state, send)
| grades => showGrades(grades, evaluationCriteria, state)
@@ -531,21 +531,21 @@ let make = (
- {switch overlaySubmission |> OverlaySubmission.grades {
+ {switch overlaySubmission->OverlaySubmission.grades {
| [] =>
OverlaySubmission.id,
+ overlaySubmission->OverlaySubmission.id,
state,
send,
evaluationCriteria,
addGradingCB,
status,
)}>
- {submitButtonText(state.newFeedback, state.grades) |> str}
+ {submitButtonText(state.newFeedback, state.grades)->str}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__IndexSubmission.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__IndexSubmission.res
index 468326276a..4bfc2d0833 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__IndexSubmission.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__IndexSubmission.res
@@ -22,25 +22,25 @@ let coachIds = t => t.coachIds
let failed = t =>
switch t.status {
| None => false
- | Some(status) => status.passedAt |> OptionUtils.mapWithDefault(_ => false, true)
+ | Some(status) => status.passedAt->OptionUtils.mapWithDefault(_ => false, true)
}
-let pendingReview = t => t.status |> OptionUtils.mapWithDefault(_ => false, true)
+let pendingReview = t => t.status->OptionUtils.mapWithDefault(_ => false, true)
-let feedbackSent = t => t.status |> OptionUtils.mapWithDefault(status => status.feedbackSent, false)
+let feedbackSent = t => t.status->OptionUtils.mapWithDefault(status => status.feedbackSent, false)
-let createdAtPretty = t => t.createdAt |> DateFns.format("MMMM D, YYYY")
+let createdAtPretty = t => t.createdAt->DateFns.format("MMMM D, YYYY")
-let timeDistance = t => t.createdAt |> DateFns.distanceInWordsToNow(~addSuffix=true)
+let timeDistance = t => t.createdAt->DateFns.distanceInWordsToNow(~addSuffix=true)
let sortArray = (sortDirection, submissions) => {
let sortDescending =
- submissions |> ArrayUtils.copyAndSort((x, y) =>
- DateFns.differenceInSeconds(y.createdAt, x.createdAt) |> int_of_float
+ submissions->ArrayUtils.copyAndSort((x, y) =>
+ DateFns.differenceInSeconds(y.createdAt, x.createdAt)->int_of_float
)
switch sortDirection {
| #Descending => sortDescending
- | #Ascending => sortDescending |> Js.Array.reverseInPlace
+ | #Ascending => sortDescending->Js.Array.reverseInPlace
}
}
@@ -57,13 +57,13 @@ let make = (~id, ~title, ~createdAt, ~levelId, ~userNames, ~status, ~coachIds) =
let makeStatus = (~passedAt, ~feedbackSent) => {passedAt: passedAt, feedbackSent: feedbackSent}
let decodeJs = details =>
- details |> Js.Array.map(s =>
+ details->Js.Array.map(s =>
switch s {
| Some(submission) =>
let status =
- submission["evaluatedAt"] |> OptionUtils.map(_ =>
+ submission["evaluatedAt"]->OptionUtils.map(_ =>
makeStatus(
- ~passedAt=submission["passedAt"] |> OptionUtils.map(DateFns.parseString),
+ ~passedAt=submission["passedAt"]->OptionUtils.map(DateFns.parseString),
~feedbackSent=submission["feedbackSent"],
)
)
@@ -72,7 +72,7 @@ let decodeJs = details =>
make(
~id=submission["id"],
~title=submission["title"],
- ~createdAt=submission["createdAt"] |> DateFns.parseString,
+ ~createdAt=submission["createdAt"]->DateFns.parseString,
~levelId=submission["levelId"],
~userNames=submission["userNames"],
~status,
@@ -83,10 +83,10 @@ let decodeJs = details =>
}
)
-let replace = (e, l) => l |> Array.map(s => s.id == e.id ? e : s)
+let replace = (e, l) => l->Array.map(s => s.id == e.id ? e : s)
let statusEq = (overlaySubmission, t) =>
- switch (t.status, overlaySubmission |> CoursesReview__OverlaySubmission.evaluatedAt) {
+ switch (t.status, overlaySubmission->CoursesReview__OverlaySubmission.evaluatedAt) {
| (None, None) => true
| (Some({passedAt}), Some(_)) =>
passedAt == CoursesReview__OverlaySubmission.passedAt(overlaySubmission)
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Level.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Level.res
index e6328c5986..d3293d8a27 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Level.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Level.res
@@ -7,9 +7,9 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- name: json |> field("name", string),
- number: json |> field("number", int),
+ id: json->field("id", string),
+ name: json->field("name", string),
+ number: json->field("number", int),
}
}
@@ -17,14 +17,14 @@ let id = t => t.id
let name = t => t.name
let number = t => t.number
-let sort = levels => levels |> ArrayUtils.copyAndSort((x, y) => x.number - y.number)
+let sort = levels => levels->ArrayUtils.copyAndSort((x, y) => x.number - y.number)
let unsafeLevelNumber = (levels, componentName, levelId) =>
"Level " ++
(levels
- |> ArrayUtils.unsafeFind(
+ ->ArrayUtils.unsafeFind(
l => l.id == levelId,
"Unable to find level with id: " ++ (levelId ++ ("in CoursesRevew__" ++ componentName)),
)
- |> number
- |> string_of_int)
+ ->number
+ ->string_of_int)
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__OverlaySubmission.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__OverlaySubmission.res
index c550ba6566..70b810fa21 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__OverlaySubmission.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__OverlaySubmission.res
@@ -38,34 +38,34 @@ let make = (
}
let makeFromJs = details =>
- details |> Js.Array.map(s =>
+ details->Js.Array.map(s =>
make(
~id=s["id"],
- ~createdAt=s["createdAt"] |> DateFns.parseString,
- ~passedAt=s["passedAt"] |> OptionUtils.map(DateFns.parseString),
+ ~createdAt=s["createdAt"]->DateFns.parseString,
+ ~passedAt=s["passedAt"]->OptionUtils.map(DateFns.parseString),
~evaluatorName=s["evaluatorName"],
- ~evaluatedAt=s["evaluatedAt"] |> OptionUtils.map(DateFns.parseString),
- ~feedback=s["feedback"] |> Js.Array.map(f =>
+ ~evaluatedAt=s["evaluatedAt"]->OptionUtils.map(DateFns.parseString),
+ ~feedback=s["feedback"]->Js.Array.map(f =>
CoursesReview__Feedback.make(
~coachName=f["coachName"],
~coachAvatarUrl=f["coachAvatarUrl"],
~coachTitle=f["coachTitle"],
- ~createdAt=f["createdAt"] |> DateFns.parseString,
+ ~createdAt=f["createdAt"]->DateFns.parseString,
~value=f["value"],
)
),
- ~grades=s["grades"] |> Js.Array.map(g =>
+ ~grades=s["grades"]->Js.Array.map(g =>
CoursesReview__Grade.make(
~evaluationCriterionId=g["evaluationCriterionId"],
~value=g["grade"],
)
),
- ~checklist=s["checklist"] |> Json.Decode.array(
+ ~checklist=s["checklist"]->Json.Decode.array(
SubmissionChecklistItem.decode(SubmissionChecklistItem.makeFiles(s["files"])),
),
)
)
-let feedbackSent = t => t.feedback |> ArrayUtils.isNotEmpty
+let feedbackSent = t => t.feedback->ArrayUtils.isNotEmpty
let updateFeedback = (feedback, t) => {...t, feedback: feedback}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ReviewChecklistItem.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ReviewChecklistItem.res
index 9fed311363..757c82726c 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ReviewChecklistItem.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ReviewChecklistItem.res
@@ -8,10 +8,10 @@ let result = t => t.result
let make = (~title, ~result) => {title: title, result: result}
let makeFromJs = data =>
- data |> Js.Array.map(rc =>
+ data->Js.Array.map(rc =>
make(
~title=rc["title"],
- ~result=rc["result"] |> CoursesReview__ReviewChecklistResult.makeFromJs,
+ ~result=rc["result"]->CoursesReview__ReviewChecklistResult.makeFromJs,
)
)
@@ -26,32 +26,32 @@ let updateTitle = (title, t) => make(~title, ~result=t.result)
let updateChecklist = (result, t) => make(~title=t.title, ~result)
let replace = (t, itemIndex, result) =>
- result |> Array.mapi((index, item) => index == itemIndex ? t : item)
+ result->Array.mapi((index, item) => index == itemIndex ? t : item)
let appendEmptyChecklistItem = t =>
make(
~title=t.title,
- ~result=[CoursesReview__ReviewChecklistResult.empty()] |> Array.append(t.result),
+ ~result=[CoursesReview__ReviewChecklistResult.empty()]->Array.append(t.result),
)
let deleteResultItem = (index, t) =>
- make(~title=t.title, ~result=t.result |> Js.Array.filteri((_el, i) => i != index))
+ make(~title=t.title, ~result=t.result->Js.Array.filteri((_el, i) => i != index))
let trim = t => {
- title: t.title |> String.trim,
- result: t.result |> Array.map(CoursesReview__ReviewChecklistResult.trim),
+ title: t.title->String.trim,
+ result: t.result->Array.map(CoursesReview__ReviewChecklistResult.trim),
}
let encode = t => {
open Json.Encode
object_(list{
- ("title", t.title |> string),
- ("result", t.result |> array(CoursesReview__ReviewChecklistResult.encode)),
+ ("title", t.title->string),
+ ("result", t.result->array(CoursesReview__ReviewChecklistResult.encode)),
})
}
let encodeArray = checklist =>
- checklist |> {
+ checklist->{
open Json.Encode
array(encode)
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ReviewChecklistResult.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ReviewChecklistResult.res
index 6605919022..05eddfba37 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ReviewChecklistResult.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ReviewChecklistResult.res
@@ -7,7 +7,7 @@ let feedback = t => t.feedback
let make = (~title, ~feedback) => {title: title, feedback: feedback}
-let makeFromJs = data => data |> Js.Array.map(r => make(~title=r["title"], ~feedback=r["feedback"]))
+let makeFromJs = data => data->Js.Array.map(r => make(~title=r["title"], ~feedback=r["feedback"]))
let emptyTemplate = () => [
make(~title="Yes", ~feedback=Some("Sample feedback for yes")),
@@ -17,24 +17,24 @@ let emptyTemplate = () => [
let empty = () => make(~title="", ~feedback=None)
let replace = (t, index, checklist) =>
- checklist |> Array.mapi((resultIndex, result) => resultIndex == index ? t : result)
+ checklist->Array.mapi((resultIndex, result) => resultIndex == index ? t : result)
let updateTitle = (title, t, index, checklist) =>
- checklist |> replace(make(~title, ~feedback=t.feedback), index)
+ checklist->replace(make(~title, ~feedback=t.feedback), index)
let updateFeedback = (feedback, t, index, checklist) => {
- let optionalFeedback = feedback |> Js.String.trim == "" ? None : Some(feedback)
+ let optionalFeedback = feedback->Js.String.trim == "" ? None : Some(feedback)
- checklist |> replace(make(~title=t.title, ~feedback=optionalFeedback), index)
+ checklist->replace(make(~title=t.title, ~feedback=optionalFeedback), index)
}
-let trim = t => {...t, title: t.title |> String.trim}
+let trim = t => {...t, title: t.title->String.trim}
let encode = t => {
- let title = list{("title", t.title |> Json.Encode.string)}
+ let title = list{("title", t.title->Json.Encode.string)}
let feedback = switch t.feedback {
- | Some(f) => list{("feedback", f |> Json.Encode.string)}
+ | Some(f) => list{("feedback", f->Json.Encode.string)}
| None => list{}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Root.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Root.res
index baa18e3e36..66cbf4f51c 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Root.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Root.res
@@ -85,7 +85,7 @@ let reducer = (state, action) =>
| Unloaded => Unloaded
| PartiallyLoaded({submissions, totalCount}, cursor) =>
Submissions.partiallyLoaded(
- ~submissions=submissions |> IndexSubmission.replace(submission),
+ ~submissions=submissions->IndexSubmission.replace(submission),
~filter,
~sortDirection=state.sortDirection,
~totalCount,
@@ -93,7 +93,7 @@ let reducer = (state, action) =>
)
| FullyLoaded({submissions, totalCount}) =>
Submissions.fullyLoaded(
- ~submissions=submissions |> IndexSubmission.replace(submission),
+ ~submissions=submissions->IndexSubmission.replace(submission),
~filter,
~totalCount,
~sortDirection=state.sortDirection,
@@ -113,13 +113,13 @@ let reducer = (state, action) =>
| SyncSubmissionStatus(overlaySubmission) =>
let skipReload =
state.pendingSubmissions
- |> Submissions.toArray
- |> Array.append(state.reviewedSubmissions |> Submissions.toArray)
- |> Js.Array.find(indexSubmission =>
- indexSubmission |> IndexSubmission.id == OverlaySubmission.id(overlaySubmission)
+ ->Submissions.toArray
+ ->Array.append(state.reviewedSubmissions->Submissions.toArray)
+ ->Js.Array.find(indexSubmission =>
+ indexSubmission->IndexSubmission.id == OverlaySubmission.id(overlaySubmission)
)
- |> OptionUtils.mapWithDefault(
- indexSubmission => indexSubmission |> IndexSubmission.statusEq(overlaySubmission),
+ ->OptionUtils.mapWithDefault(
+ indexSubmission => indexSubmission->IndexSubmission.statusEq(overlaySubmission),
true,
)
@@ -149,14 +149,14 @@ let computeInitialState = currentTeamCoach => {
}
let openOverlay = (submissionId, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
ReasonReactRouter.push("/submissions/" ++ submissionId)
}
let dropdownElementClasses = (level, selectedLevel) =>
"p-3 w-full text-left font-semibold focus:outline-none " ++
switch (selectedLevel, level) {
- | (Some(sl), Some(l)) if l |> Level.id == (sl |> Level.id) => "bg-gray-200 text-primary-500"
+ | (Some(sl), Some(l)) if l->Level.id == (sl->Level.id) => "bg-gray-200 text-primary-500"
| (None, None) => "bg-gray-200 text-primary-500"
| _ => ""
}
@@ -175,26 +175,26 @@ module Selectable = {
let label = t =>
switch t {
- | Level(level) => Some("Level " ++ (level |> Level.number |> string_of_int))
+ | Level(level) => Some("Level " ++ (level->Level.number->string_of_int))
| AssignedToCoach(_) => Some("Assigned to")
}
let value = t =>
switch t {
- | Level(level) => level |> Level.name
+ | Level(level) => level->Level.name
| AssignedToCoach(coach, currentCoachId) =>
- coach |> Coach.id == currentCoachId ? "Me" : coach |> Coach.name
+ coach->Coach.id == currentCoachId ? "Me" : coach->Coach.name
}
let searchString = t =>
switch t {
| Level(level) =>
- "level " ++ ((level |> Level.number |> string_of_int) ++ (" " ++ (level |> Level.name)))
+ "level " ++ ((level->Level.number->string_of_int) ++ (" " ++ (level->Level.name)))
| AssignedToCoach(coach, currentCoachId) =>
- if coach |> Coach.id == currentCoachId {
- (coach |> Coach.name) ++ " assigned to me"
+ if coach->Coach.id == currentCoachId {
+ (coach->Coach.name) ++ " assigned to me"
} else {
- "assigned to " ++ (coach |> Coach.name)
+ "assigned to " ++ (coach->Coach.name)
}
}
@@ -208,41 +208,41 @@ module Multiselect = MultiselectDropdown.Make(Selectable)
let unselected = (levels, coaches, currentCoachId, state) => {
let unselectedLevels =
levels
- |> Js.Array.filter(level =>
- state.selectedLevel |> OptionUtils.mapWithDefault(
- selectedLevel => level |> Level.id != (selectedLevel |> Level.id),
+ ->Js.Array.filter(level =>
+ state.selectedLevel->OptionUtils.mapWithDefault(
+ selectedLevel => level->Level.id != (selectedLevel->Level.id),
true,
)
)
- |> Array.map(Selectable.level)
+ ->Array.map(Selectable.level)
let unselectedCoaches =
coaches
- |> Js.Array.filter(coach =>
- state.selectedCoach |> OptionUtils.mapWithDefault(
- selectedCoach => coach |> Coach.id != Coach.id(selectedCoach),
+ ->Js.Array.filter(coach =>
+ state.selectedCoach->OptionUtils.mapWithDefault(
+ selectedCoach => coach->Coach.id != Coach.id(selectedCoach),
true,
)
)
- |> Array.map(coach => Selectable.assignedToCoach(coach, currentCoachId))
+ ->Array.map(coach => Selectable.assignedToCoach(coach, currentCoachId))
- unselectedLevels |> Array.append(unselectedCoaches)
+ unselectedLevels->Array.append(unselectedCoaches)
}
let selected = (state, currentCoachId) => {
let selectedLevel =
- state.selectedLevel |> OptionUtils.mapWithDefault(
+ state.selectedLevel->OptionUtils.mapWithDefault(
selectedLevel => [Selectable.level(selectedLevel)],
[],
)
let selectedCoach =
- state.selectedCoach |> OptionUtils.mapWithDefault(
+ state.selectedCoach->OptionUtils.mapWithDefault(
selectedCoach => [Selectable.assignedToCoach(selectedCoach, currentCoachId)],
[],
)
- selectedLevel |> Array.append(selectedCoach)
+ selectedLevel->Array.append(selectedCoach)
}
let onSelectFilter = (send, selectable) =>
@@ -268,16 +268,16 @@ let filterPlaceholder = state =>
let restoreFilterNotice = (send, currentCoach, message) =>
- {message |> str}
+ {message->str}
send(SelectCoach(currentCoach))}>
- {"Assigned to: Me" |> str}
+ {"Assigned to: Me"->str}
let restoreAssignedToMeFilter = (state, send, currentTeamCoach) =>
- currentTeamCoach |> OptionUtils.mapWithDefault(currentCoach =>
+ currentTeamCoach->OptionUtils.mapWithDefault(currentCoach =>
switch state.selectedCoach {
| None =>
restoreFilterNotice(
@@ -285,28 +285,28 @@ let restoreAssignedToMeFilter = (state, send, currentTeamCoach) =>
currentCoach,
"Now showing submissions from all students in this course.",
)
- | Some(selectedCoach) if selectedCoach |> Coach.id == Coach.id(currentCoach) => React.null
+ | Some(selectedCoach) if selectedCoach->Coach.id == Coach.id(currentCoach) => React.null
| Some(selectedCoach) =>
restoreFilterNotice(
send,
currentCoach,
- "Now showing submissions assigned to " ++ ((selectedCoach |> Coach.name) ++ "."),
+ "Now showing submissions assigned to " ++ ((selectedCoach->Coach.name) ++ "."),
)
}
, React.null)
let filterSubmissions = (selectedLevel, selectedCoach, submissions) => {
let levelFiltered =
- selectedLevel |> OptionUtils.mapWithDefault(
+ selectedLevel->OptionUtils.mapWithDefault(
level =>
- submissions |> Js.Array.filter(l => l |> IndexSubmission.levelId == (level |> Level.id)),
+ submissions->Js.Array.filter(l => l->IndexSubmission.levelId == (level->Level.id)),
submissions,
)
- selectedCoach |> OptionUtils.mapWithDefault(
+ selectedCoach->OptionUtils.mapWithDefault(
coach =>
- levelFiltered |> Js.Array.filter(l =>
- l |> IndexSubmission.coachIds |> Array.mem(coach |> Coach.id)
+ levelFiltered->Js.Array.filter(l =>
+ l->IndexSubmission.coachIds->Array.mem(coach->Coach.id)
),
levelFiltered,
)
@@ -324,7 +324,7 @@ module SubmissionsSorter = Sorter.Make(Sortable)
let submissionsSorter = (state, send) => {
let criteria = [{criterion: "Submitted At", criterionType: #Number}]
-
+
let submissionsCount = submissions =>
submissions
- |> Submissions.totalCount
- |> OptionUtils.mapWithDefault(
+ ->Submissions.totalCount
+ ->OptionUtils.mapWithDefault(
count =>
- {count |> string_of_int |> str}
+ {count->string_of_int->str}
,
React.null,
)
@@ -356,7 +356,7 @@ let submissionsCount = submissions =>
@react.component
let make = (~levels, ~courseId, ~teamCoaches, ~currentCoach) => {
let (currentTeamCoach, _) = React.useState(() =>
- teamCoaches->Belt.Array.some(coach => coach |> Coach.id == (currentCoach |> Coach.id))
+ teamCoaches->Belt.Array.some(coach => coach->Coach.id == (currentCoach->Coach.id))
? Some(currentCoach)
: None
)
@@ -389,24 +389,24 @@ let make = (~levels, ~courseId, ~teamCoaches, ~currentCoach) => {
send(SelectPendingTab)}>
- {"Pending" |> str} {submissionsCount(state.pendingSubmissions)}
+ {"Pending"->str} {submissionsCount(state.pendingSubmissions)}
send(SelectReviewedTab)}>
- {"Reviewed" |> str}
+ {"Reviewed"->str}
Coach.id, state)}
- selected={selected(state, currentCoach |> Coach.id)}
+ unselected={unselected(levels, teamCoaches, currentCoach->Coach.id, state)}
+ selected={selected(state, currentCoach->Coach.id)}
onSelect={onSelectFilter(send)}
onDeselect={onDeselectFilter(send)}
value=state.filterString
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ShowFeedback.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ShowFeedback.res
index 87c69fd923..ffbcce7e96 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ShowFeedback.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__ShowFeedback.res
@@ -20,8 +20,8 @@ let createFeedback = (submissionId, feedback, setState, addFeedbackCB) => {
setState(state => {...state, saving: true})
CreateFeedbackMutation.make(~submissionId, ~feedback, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
response["createFeedback"]["success"]
? {
addFeedbackCB(feedback)
@@ -30,30 +30,30 @@ let createFeedback = (submissionId, feedback, setState, addFeedbackCB) => {
: setState(state => {...state, saving: false})
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let showFeedback = feedback =>
feedback
- |> Array.mapi((index, f) =>
- string_of_int} className="border-t p-4 md:p-6">
+ ->Array.mapi((index, f) =>
+
string_of_int} className="border-t p-4 md:p-6">
- {switch f |> Feedback.coachAvatarUrl {
+ {switch f->Feedback.coachAvatarUrl {
| Some(avatarUrl) =>

- | None =>
Feedback.coachName} />
+ | None => Feedback.coachName} />
}}
-
{"Feedback from:" |> str}
+
{"Feedback from:"->str}
- {f |> Feedback.coachName |> str}
+ {f->Feedback.coachName->str}
- {"(" ++ ((f |> Feedback.coachTitle) ++ ")") |> str}
+ {"(" ++ ((f->Feedback.coachTitle) ++ ")")->str}
@@ -61,15 +61,15 @@ let showFeedback = feedback =>
- {f |> Feedback.createdAtPretty |> str}
+ {f->Feedback.createdAtPretty->str}
Feedback.value}
+ className="pt-1 text-sm" profile=Markdown.Permissive markdown={f->Feedback.value}
/>
)
- |> React.array
+ ->React.array
let updateFeedbackCB = (setState, newFeedback) =>
setState(state => {...state, newFeedback: newFeedback})
@@ -112,7 +112,7 @@ let make = (
className="btn btn-success border border-green-600 w-full md:w-auto"
onClick={_ =>
createFeedback(submissionId, state.newFeedback, setState, addFeedbackCB)}>
- {"Share Feedback" |> str}
+ {"Share Feedback"->str}
@@ -123,7 +123,7 @@ let make = (
{switch feedback {
| [] => "Add feedback"
| _ => "Add another feedback"
- } |> str}
+ }->str}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionDetails.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionDetails.res
index e600486c4c..3dd1293511 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionDetails.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionDetails.res
@@ -55,49 +55,49 @@ let make = (
let decodeJs = details =>
make(
- ~submissions=details["submissions"] |> OverlaySubmission.makeFromJs,
+ ~submissions=details["submissions"]->OverlaySubmission.makeFromJs,
~targetId=details["targetId"],
~targetTitle=details["targetTitle"],
- ~students=details["students"] |> Array.map(Student.makeFromJs),
+ ~students=details["students"]->Array.map(Student.makeFromJs),
~levelNumber=details["levelNumber"],
~levelId=details["levelId"],
~targetEvaluationCriteriaIds=details["targetEvaluationCriteriaIds"],
~inactiveStudents=details["inactiveStudents"],
- ~evaluationCriteria=details["evaluationCriteria"] |> Js.Array.map(ec =>
+ ~evaluationCriteria=details["evaluationCriteria"]->Js.Array.map(ec =>
EvaluationCriterion.make(
~id=ec["id"],
~name=ec["name"],
~maxGrade=ec["maxGrade"],
~passGrade=ec["passGrade"],
- ~gradesAndLabels=ec["gradeLabels"] |> Array.map(gradeAndLabel =>
+ ~gradesAndLabels=ec["gradeLabels"]->Array.map(gradeAndLabel =>
GradeLabel.makeFromJs(gradeAndLabel)
),
)
),
- ~reviewChecklist=details["reviewChecklist"] |> ReviewChecklistItem.makeFromJs,
+ ~reviewChecklist=details["reviewChecklist"]->ReviewChecklistItem.makeFromJs,
~coachIds=details["coachIds"],
)
let updateSubmission = (submission, t) => {
...t,
submissions: t.submissions
- |> Js.Array.filter(s => s |> OverlaySubmission.id != (submission |> OverlaySubmission.id))
- |> Array.append([submission]),
+ ->Js.Array.filter(s => s->OverlaySubmission.id != (submission->OverlaySubmission.id))
+ ->Array.append([submission]),
}
let makeIndexSubmission = (overlaySubmission, t) =>
IndexSubmission.make(
- ~id=overlaySubmission |> OverlaySubmission.id,
+ ~id=overlaySubmission->OverlaySubmission.id,
~title=t.targetTitle,
- ~createdAt=overlaySubmission |> OverlaySubmission.createdAt,
+ ~createdAt=overlaySubmission->OverlaySubmission.createdAt,
~levelId=t.levelId,
~userNames=t.students
- |> Array.map(student => student |> CoursesReview__Student.name)
- |> Js.Array.joinWith(", "),
+ ->Array.map(student => student->CoursesReview__Student.name)
+ ->Js.Array.joinWith(", "),
~status=Some(
IndexSubmission.makeStatus(
- ~passedAt=overlaySubmission |> OverlaySubmission.passedAt,
- ~feedbackSent=overlaySubmission |> OverlaySubmission.feedbackSent,
+ ~passedAt=overlaySubmission->OverlaySubmission.passedAt,
+ ~feedbackSent=overlaySubmission->OverlaySubmission.feedbackSent,
),
),
~coachIds=t.coachIds,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionOverlay.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionOverlay.res
index 37a4a5424f..eff55a1807 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionOverlay.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionOverlay.res
@@ -51,15 +51,15 @@ module SubmissionDetailsQuery = %graphql(`
* Then, set the state of this component to Loaded.
*/
let updateSubmissionDetails = (setState, submissionId, syncSubmissionCB, details) => {
- let submissionDetails = details |> SubmissionDetails.decodeJs
+ let submissionDetails = details->SubmissionDetails.decodeJs
submissionDetails
- |> SubmissionDetails.submissions
- |> ArrayUtils.unsafeFind(
- submission => submission |> OverlaySubmission.id == submissionId,
+ ->SubmissionDetails.submissions
+ ->ArrayUtils.unsafeFind(
+ submission => submission->OverlaySubmission.id == submissionId,
"Could not find overlaySubmission with ID " ++ (submissionId ++ " in loaded submissions"),
)
- |> syncSubmissionCB
+ ->syncSubmissionCB
setState(_ => Loaded(submissionDetails))
}
@@ -67,16 +67,16 @@ let updateSubmissionDetails = (setState, submissionId, syncSubmissionCB, details
let getSubmissionDetails = (submissionId, setState, syncSubmissionCB, ()) => {
setState(_ => Loading)
SubmissionDetailsQuery.make(~submissionId, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
- response["submissionDetails"] |> updateSubmissionDetails(
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
+ response["submissionDetails"]->updateSubmissionDetails(
setState,
submissionId,
syncSubmissionCB,
)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
None
}
@@ -94,40 +94,40 @@ let headerSection = (submissionDetails, courseId, assignedCoaches) =>
onClick={_ => closeOverlay(courseId)}
className="review-submission-overlay__close flex flex-col items-center justify-center absolute rounded-t-lg lg:rounded-lg leading-tight px-4 py-1 h-8 lg:h-full cursor-pointer border border-b-0 border-gray-400 lg:border-0 lg:shadow lg:border-gray-300 bg-white text-gray-700 hover:text-gray-900 hover:bg-gray-100">
-
{"close" |> str}
+
{"close"->str}
@@ -135,7 +135,7 @@ let headerSection = (submissionDetails, courseId, assignedCoaches) =>
tooltipPosition=#Bottom
defaultAvatarSize="8"
mdAvatarSize="8"
- title={
{"Assigned Coaches" |> str} }
+ title={
{"Assigned Coaches"->str} }
className="mt-2 flex w-full md:w-auto items-center flex-shrink-0"
coaches=assignedCoaches
/>
@@ -145,7 +145,7 @@ let headerSection = (submissionDetails, courseId, assignedCoaches) =>
let updateSubmissionDetails = (setState, submissionDetails, overlaySubmission) => {
// Create new details for overlay with updated overlaySubmission.
let newSubmissionDetails =
- submissionDetails |> SubmissionDetails.updateSubmission(overlaySubmission)
+ submissionDetails->SubmissionDetails.updateSubmission(overlaySubmission)
// Re-render the overlay with the updated submission details.
setState(_ => Loaded(newSubmissionDetails))
@@ -154,7 +154,7 @@ let updateSubmissionDetails = (setState, submissionDetails, overlaySubmission) =
}
let addGrading = (setState, removePendingSubmissionCB, submissionDetails, overlaySubmission) => {
- updateSubmissionDetails(setState, submissionDetails, overlaySubmission) |> ignore
+ updateSubmissionDetails(setState, submissionDetails, overlaySubmission)->ignore
removePendingSubmissionCB()
}
@@ -166,24 +166,24 @@ let addFeedbackToReviewedSubmission = (
overlaySubmission,
) =>
updateSubmissionDetails(setState, submissionDetails, overlaySubmission)
- |> SubmissionDetails.makeIndexSubmission(overlaySubmission)
- |> updateReviewedSubmissionCB
+ ->SubmissionDetails.makeIndexSubmission(overlaySubmission)
+ ->updateReviewedSubmissionCB
let updateReviewChecklist = (submissionDetails, setState, reviewChecklist) =>
setState(_ => Loaded(
- submissionDetails |> SubmissionDetails.updateReviewChecklist(reviewChecklist),
+ submissionDetails->SubmissionDetails.updateReviewChecklist(reviewChecklist),
))
let inactiveWarning = submissionDetails =>
- if submissionDetails |> SubmissionDetails.inactiveStudents {
- let warning = if submissionDetails |> SubmissionDetails.students |> Array.length > 1 {
+ if submissionDetails->SubmissionDetails.inactiveStudents {
+ let warning = if submissionDetails->SubmissionDetails.students->Array.length > 1 {
"This submission is linked to one or more students whose access to the course has ended, or have dropped out."
} else {
"This submission is from a student whose access to the course has ended, or has dropped out."
}
- {warning |> str}
+ {warning->str}
} else {
React.null
@@ -211,8 +211,8 @@ let make = (
{switch state {
| Loaded(submissionDetails) =>
let assignedCoaches =
- teamCoaches |> Js.Array.filter(coach =>
- submissionDetails |> SubmissionDetails.coachIds |> Array.mem(coach |> Coach.id)
+ teamCoaches->Js.Array.filter(coach =>
+ submissionDetails->SubmissionDetails.coachIds->Array.mem(coach->Coach.id)
)
@@ -223,13 +223,13 @@ let make = (
{submissionDetails
- |> SubmissionDetails.submissions
- |> Array.mapi((index, overlaySubmission) =>
+ ->SubmissionDetails.submissions
+ ->Array.mapi((index, overlaySubmission) =>
string_of_int}
+ key={index->string_of_int}
overlaySubmission
- teamSubmission={submissionDetails |> SubmissionDetails.students |> Array.length > 1}
- targetEvaluationCriteriaIds={submissionDetails |> SubmissionDetails.targetEvaluationCriteriaIds}
+ teamSubmission={submissionDetails->SubmissionDetails.students->Array.length > 1}
+ targetEvaluationCriteriaIds={submissionDetails->SubmissionDetails.targetEvaluationCriteriaIds}
addGradingCB={addGrading(setState, removePendingSubmissionCB, submissionDetails)}
addFeedbackCB={addFeedbackToReviewedSubmission(
setState,
@@ -237,16 +237,16 @@ let make = (
submissionDetails,
)}
submissionNumber={(submissionDetails
- |> SubmissionDetails.submissions
- |> Array.length) - index}
+ ->SubmissionDetails.submissions
+ ->Array.length) - index}
currentCoach
- evaluationCriteria={submissionDetails |> SubmissionDetails.evaluationCriteria}
- reviewChecklist={submissionDetails |> SubmissionDetails.reviewChecklist}
+ evaluationCriteria={submissionDetails->SubmissionDetails.evaluationCriteria}
+ reviewChecklist={submissionDetails->SubmissionDetails.reviewChecklist}
updateReviewChecklistCB={updateReviewChecklist(submissionDetails, setState)}
- targetId={submissionDetails |> SubmissionDetails.targetId}
+ targetId={submissionDetails->SubmissionDetails.targetId}
/>
)
- |> React.array}
+ ->React.array}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Submissions.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Submissions.res
index 95b8c1d05b..572ba08050 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Submissions.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__Submissions.res
@@ -7,12 +7,12 @@ type filter = {
let makeFilter = (level, coach) => {level: level, coach: coach}
-let filterLevelId = level => level |> OptionUtils.mapWithDefault(Level.id, "none")
-let filterCoachId = coach => coach |> OptionUtils.mapWithDefault(UserProxy.id, "none")
+let filterLevelId = level => level->OptionUtils.mapWithDefault(Level.id, "none")
+let filterCoachId = coach => coach->OptionUtils.mapWithDefault(UserProxy.id, "none")
let filterEq = (level, coach, filter) =>
- filter.level |> filterLevelId == filterLevelId(level) &&
- filter.coach |> filterCoachId == filterCoachId(coach)
+ filter.level->filterLevelId == filterLevelId(level) &&
+ filter.coach->filterCoachId == filterCoachId(coach)
type sortDirection = [#Ascending | #Descending]
@@ -63,7 +63,7 @@ let needsReloading = (selectedLevel, selectedCoach, sortDirection, t) =>
| Unloaded => true
| FullyLoaded(data)
| PartiallyLoaded(data, _) =>
- !(data.filter |> filterEq(selectedLevel, selectedCoach) && data.sortDirection == sortDirection)
+ !(data.filter->filterEq(selectedLevel, selectedCoach) && data.sortDirection == sortDirection)
}
let toArray = t =>
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionsList.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionsList.res
index 06734ef594..1d80e7a8c5 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionsList.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionsList.res
@@ -3,30 +3,30 @@ let str = React.string
let showSubmissionStatus = overlaySubmission => {
let (text, classes) = switch (
- overlaySubmission |> OverlaySubmission.passedAt,
- overlaySubmission |> OverlaySubmission.evaluatorName,
+ overlaySubmission->OverlaySubmission.passedAt,
+ overlaySubmission->OverlaySubmission.evaluatorName,
) {
| (None, None) => ("Pending", "bg-orange-100 border border-orange-500 text-orange-800 ")
| (None, Some(_)) => ("Failed", "bg-red-100 border border-red-500 text-red-700")
| (Some(_), None)
| (Some(_), Some(_)) => ("Passed", "bg-green-100 border border-green-500 text-green-800")
}
-
{text |> str}
+
{text->str}
}
let showFeedbackSent = feedbackSent =>
feedbackSent
?
- {"Feedback Sent" |> str}
+ {"Feedback Sent"->str}
: React.null
let cardClasses = overlaySubmission =>
"mt-6 rounded-b-lg bg-white border-t-3 " ++
switch (
- overlaySubmission |> OverlaySubmission.passedAt,
- overlaySubmission |> OverlaySubmission.evaluatorName,
+ overlaySubmission->OverlaySubmission.passedAt,
+ overlaySubmission->OverlaySubmission.evaluatorName,
) {
| (None, None) => "border-orange-300"
| (None, Some(_)) => "border-red-500"
@@ -46,39 +46,39 @@ let updateSubmission = (
) => {
let feedback = switch newFeedback {
| Some(f) =>
- f |> String.trim == ""
- ? overlaySubmission |> OverlaySubmission.feedback
+ f->String.trim == ""
+ ? overlaySubmission->OverlaySubmission.feedback
: overlaySubmission
- |> OverlaySubmission.feedback
- |> Array.append([
+ ->OverlaySubmission.feedback
+ ->Array.append([
Feedback.make(
- ~coachName=currentCoach |> Coach.name,
- ~coachAvatarUrl=currentCoach |> Coach.avatarUrl,
- ~coachTitle=currentCoach |> Coach.title,
+ ~coachName=currentCoach->Coach.name,
+ ~coachAvatarUrl=currentCoach->Coach.avatarUrl,
+ ~coachTitle=currentCoach->Coach.title,
~createdAt=Js.Date.make(),
~value=f,
),
])
- | None => overlaySubmission |> OverlaySubmission.feedback
+ | None => overlaySubmission->OverlaySubmission.feedback
}
let (passedAt, evaluatedAt, newGrades) = switch passed {
| Some(p) => (p ? Some(Js.Date.make()) : None, Some(Js.Date.make()), grades)
| None => (
- overlaySubmission |> OverlaySubmission.passedAt,
- overlaySubmission |> OverlaySubmission.evaluatedAt,
- overlaySubmission |> OverlaySubmission.grades,
+ overlaySubmission->OverlaySubmission.passedAt,
+ overlaySubmission->OverlaySubmission.evaluatedAt,
+ overlaySubmission->OverlaySubmission.grades,
)
}
let newSubmission = OverlaySubmission.make(
- ~id=overlaySubmission |> OverlaySubmission.id,
- ~createdAt=overlaySubmission |> OverlaySubmission.createdAt,
+ ~id=overlaySubmission->OverlaySubmission.id,
+ ~createdAt=overlaySubmission->OverlaySubmission.createdAt,
~passedAt,
~evaluatorName=if feedbackUpdate {
- overlaySubmission |> OverlaySubmission.evaluatorName
+ overlaySubmission->OverlaySubmission.evaluatorName
} else {
- Some(currentCoach |> Coach.name)
+ Some(currentCoach->Coach.name)
},
~feedback,
~grades=newGrades,
@@ -90,15 +90,15 @@ let updateSubmission = (
}
let updateFeedbackArray = (currentCoach, overlaySubmission, newFeedback) =>
- newFeedback |> String.trim == ""
- ? overlaySubmission |> OverlaySubmission.feedback
+ newFeedback->String.trim == ""
+ ? overlaySubmission->OverlaySubmission.feedback
: overlaySubmission
- |> OverlaySubmission.feedback
- |> Array.append([
+ ->OverlaySubmission.feedback
+ ->Array.append([
Feedback.make(
- ~coachName=currentCoach |> Coach.name,
- ~coachAvatarUrl=currentCoach |> Coach.avatarUrl,
- ~coachTitle=currentCoach |> Coach.title,
+ ~coachName=currentCoach->Coach.name,
+ ~coachAvatarUrl=currentCoach->Coach.avatarUrl,
+ ~coachTitle=currentCoach->Coach.title,
~createdAt=Js.Date.make(),
~value=newFeedback,
),
@@ -119,21 +119,21 @@ let addGrading = (
let evaluatedAt = Some(Js.Date.make())
OverlaySubmission.make(
- ~id=overlaySubmission |> OverlaySubmission.id,
- ~createdAt=overlaySubmission |> OverlaySubmission.createdAt,
+ ~id=overlaySubmission->OverlaySubmission.id,
+ ~createdAt=overlaySubmission->OverlaySubmission.createdAt,
~passedAt,
- ~evaluatorName=Some(currentCoach |> Coach.name),
+ ~evaluatorName=Some(currentCoach->Coach.name),
~feedback,
~grades,
~evaluatedAt,
~checklist,
- ) |> addGradingCB
+ )->addGradingCB
}
let addFeedback = (addFeedbackCB, currentCoach, overlaySubmission, newFeedback) => {
let feedback = updateFeedbackArray(currentCoach, overlaySubmission, newFeedback)
- overlaySubmission |> OverlaySubmission.updateFeedback(feedback) |> addFeedbackCB
+ overlaySubmission->OverlaySubmission.updateFeedback(feedback)->addFeedbackCB
}
@react.component
@@ -151,25 +151,25 @@ let make = (
~targetEvaluationCriteriaIds,
) =>
OverlaySubmission.id)}
+ ariaLabel={"submissions-overlay-card-" ++ (overlaySubmission->OverlaySubmission.id)}
className={cardClasses(overlaySubmission)}>
- {"Submission #" ++ (submissionNumber |> string_of_int) |> str}
+ {"Submission #" ++ (submissionNumber->string_of_int)->str}
{overlaySubmission
- |> OverlaySubmission.createdAt
- |> DateFns.format("MMMM D, YYYY")
- |> str}
+ ->OverlaySubmission.createdAt
+ ->DateFns.format("MMMM D, YYYY")
+ ->str}
{showFeedbackSent(
- overlaySubmission |> OverlaySubmission.feedback |> ArrayUtils.isNotEmpty,
+ overlaySubmission->OverlaySubmission.feedback->ArrayUtils.isNotEmpty,
)}
{showSubmissionStatus(overlaySubmission)}
@@ -185,9 +185,9 @@ let make = (
targetId
/>
OverlaySubmission.feedback}
- reviewed={overlaySubmission |> OverlaySubmission.grades |> ArrayUtils.isNotEmpty}
- submissionId={overlaySubmission |> OverlaySubmission.id}
+ feedback={overlaySubmission->OverlaySubmission.feedback}
+ reviewed={overlaySubmission->OverlaySubmission.grades->ArrayUtils.isNotEmpty}
+ submissionId={overlaySubmission->OverlaySubmission.id}
reviewChecklist
addFeedbackCB={addFeedback(addFeedbackCB, currentCoach, overlaySubmission)}
updateReviewChecklistCB
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionsTab.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionsTab.res
index ce68ee90cf..3b1cb43d13 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionsTab.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesReview__SubmissionsTab.res
@@ -48,14 +48,14 @@ let updateSubmissions = (
nodes,
) => {
updateSubmissionsCB(
- ~submissions=submissions |> Array.append(
+ ~submissions=submissions->Array.append(
switch nodes {
| None => []
- | Some(submissionsArray) => submissionsArray |> IndexSubmission.decodeJs
+ | Some(submissionsArray) => submissionsArray->IndexSubmission.decodeJs
}
- |> Array.to_list
- |> List.flatten
- |> Array.of_list,
+ ->Array.to_list
+ ->List.flatten
+ ->Array.of_list,
),
~selectedTab,
~hasNextPage,
@@ -86,8 +86,8 @@ let getSubmissions = (
}
)
- let levelId = selectedLevel |> OptionUtils.map(level => level |> Level.id)
- let coachId = selectedCoach |> OptionUtils.map(coach => coach |> Coach.id)
+ let levelId = selectedLevel->OptionUtils.map(level => level->Level.id)
+ let coachId = selectedCoach->OptionUtils.map(coach => coach->Coach.id)
SubmissionsQuery.make(
~courseId,
@@ -98,9 +98,9 @@ let getSubmissions = (
~after=?cursor,
(),
)
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
- response["submissions"]["nodes"] |> updateSubmissions(
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
+ response["submissions"]["nodes"]->updateSubmissions(
setState,
response["submissions"]["pageInfo"]["endCursor"],
response["submissions"]["pageInfo"]["hasNextPage"],
@@ -111,37 +111,37 @@ let getSubmissions = (
)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let submissionStatus = submission => {
let classes = "border flex-shrink-0 leading-normal font-semibold px-3 py-px rounded "
- let (className, text) = if submission |> IndexSubmission.pendingReview {
- (classes ++ "bg-orange-100 text-orange-600", submission |> IndexSubmission.timeDistance)
- } else if submission |> IndexSubmission.failed {
+ let (className, text) = if submission->IndexSubmission.pendingReview {
+ (classes ++ "bg-orange-100 text-orange-600", submission->IndexSubmission.timeDistance)
+ } else if submission->IndexSubmission.failed {
(classes ++ "bg-red-100 border-red-500 text-red-800", "Failed")
} else {
("bg-green-100 border-green-500 text-green-800", "Passed")
}
- {text |> str}
+ {text->str}
}
let feedbackSentNotice = feedbackSent =>
feedbackSent
?
- {"Feedback Sent" |> str}
+ {"Feedback Sent"->str}
: React.null
let submissionCardClasses = submission =>
"flex flex-col md:flex-row items-start md:items-center justify-between bg-white border-l-3 p-3 md:py-6 md:px-5 mb-4 cursor-pointer rounded-r-lg shadow hover:border-primary-500 hover:text-primary-500 hover:shadow-md " ++ if (
- submission |> IndexSubmission.pendingReview
+ submission->IndexSubmission.pendingReview
) {
"border-orange-400"
- } else if submission |> IndexSubmission.failed {
+ } else if submission->IndexSubmission.failed {
"border-red-500"
} else {
"border-green-500"
@@ -150,42 +150,42 @@ let submissionCardClasses = submission =>
let showSubmission = (submissions, levels, sortDirection) =>
{submissions
- |> IndexSubmission.sortArray(sortDirection)
- |> Array.map(submission =>
+ ->IndexSubmission.sortArray(sortDirection)
+ ->Array.map(submission =>
IndexSubmission.id)}
- key={submission |> IndexSubmission.id}
- ariaLabel={"Submission " ++ (submission |> IndexSubmission.id)}
+ href={"/submissions/" ++ (submission->IndexSubmission.id)}
+ key={submission->IndexSubmission.id}
+ ariaLabel={"Submission " ++ (submission->IndexSubmission.id)}
className={submissionCardClasses(submission)}>
{submission
- |> IndexSubmission.levelId
- |> Level.unsafeLevelNumber(levels, "SubmissionsTab")
- |> str}
+ ->IndexSubmission.levelId
+ ->Level.unsafeLevelNumber(levels, "SubmissionsTab")
+ ->str}
- {submission |> IndexSubmission.title |> str}
+ {submission->IndexSubmission.title->str}
- {"Submitted by " |> str}
+ {"Submitted by "->str}
- {submission |> IndexSubmission.userNames |> str}
+ {submission->IndexSubmission.userNames->str}
- {"on " ++ (submission |> IndexSubmission.createdAtPretty) |> str}
+ {"on " ++ (submission->IndexSubmission.createdAtPretty)->str}
- {feedbackSentNotice(submission |> IndexSubmission.feedbackSent)}
+ {feedbackSentNotice(submission->IndexSubmission.feedbackSent)}
{submissionStatus(submission)}
)
- |> React.array}
+ ->React.array}
let showSubmissions = (submissions, selectedTab, levels, sortDirection) => {
@@ -194,10 +194,10 @@ let showSubmissions = (submissions, selectedTab, levels, sortDirection) => {
| #Reviewed => reviewedEmptyImage
}
- submissions |> ArrayUtils.isEmpty
+ submissions->ArrayUtils.isEmpty
?
- {"No submissions found" |> str}
+ {"No submissions found"->str}
@@ -218,7 +218,7 @@ let make = (
) => {
let (state, setState) = React.useState(() => Loading)
React.useEffect5(() => {
- if submissions |> Submissions.needsReloading(selectedLevel, selectedCoach, sortDirection) {
+ if submissions->Submissions.needsReloading(selectedLevel, selectedCoach, sortDirection) {
setState(_ => Reloading)
getSubmissions(
@@ -260,7 +260,7 @@ let make = (
submissions,
updateSubmissionsCB,
)}>
- {"Load More..." |> str}
+ {"Load More..."->str}
}
| FullyLoaded({submissions}) => showSubmissions(submissions, selectedTab, levels, sortDirection)
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNote.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNote.res
index c6b6e90950..412d10933d 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNote.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNote.res
@@ -20,17 +20,17 @@ let createdAt = t => t.createdAt
let author = t => t.author
-let noteOn = t => t.createdAt |> DateFns.format("MMMM D, YYYY")
+let noteOn = t => t.createdAt->DateFns.format("MMMM D, YYYY")
let sort = notes =>
- notes |> ArrayUtils.copyAndSort((x, y) =>
- DateFns.differenceInSeconds(y.createdAt, x.createdAt) |> int_of_float
+ notes->ArrayUtils.copyAndSort((x, y) =>
+ DateFns.differenceInSeconds(y.createdAt, x.createdAt)->int_of_float
)
let makeFromJs = note =>
make(
~id=note["id"],
~note=note["note"],
- ~createdAt=note["createdAt"] |> DateFns.parseString,
- ~author=note["author"] |> OptionUtils.map(User.makeFromJs),
+ ~createdAt=note["createdAt"]->DateFns.parseString,
+ ~author=note["author"]->OptionUtils.map(User.makeFromJs),
)
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNoteShow.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNoteShow.res
index d6b220e0b9..bc22ce429e 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNoteShow.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNoteShow.res
@@ -13,15 +13,15 @@ module ArchiveCoachNoteMutation = %graphql(`
`)
let removeCoachNote = (id, removeNoteCB, setArchiving, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
setArchiving(_ => true)
if {
open Webapi.Dom
- window |> Window.confirm("Are you sure you want to delete this note?")
+ window->Window.confirm("Are you sure you want to delete this note?")
} {
ArchiveCoachNoteMutation.make(~id, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
if response["archiveCoachNote"]["success"] {
removeNoteCB(id)
} else {
@@ -29,7 +29,7 @@ let removeCoachNote = (id, removeNoteCB, setArchiving, event) => {
}
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
} else {
()
}
@@ -39,20 +39,20 @@ let deleteIcon = (note, removeCoachNote, removeNoteCB, setArchiving, archiving)
CoachNote.id)}
- onClick={removeCoachNote(note |> CoachNote.id, removeNoteCB, setArchiving)}>
+ title={"Delete " ++ (note->CoachNote.id)}
+ onClick={removeCoachNote(note->CoachNote.id, removeNoteCB, setArchiving)}>
@react.component
let make = (~note, ~userId, ~removeNoteCB) => {
let (archiving, setArchiving) = React.useState(() => false)
-
CoachNote.id} ariaLabel={"Note " ++ (note |> CoachNote.id)}>
+
CoachNote.id} ariaLabel={"Note " ++ (note->CoachNote.id)}>
- {switch note |> CoachNote.author {
+ {switch note->CoachNote.author {
| Some(user) =>
- switch user |> User.avatarUrl {
+ switch user->User.avatarUrl {
| Some(avatarUrl) =>
![]()
{
/>
| None =>
User.name}
+ name={user->User.name}
className="w-8 h-8 md:w-10 md:h-10 text-xs border border-gray-400 rounded-full overflow-hidden flex-shrink-0 mt-1 md:mt-0 mr-2 md:mr-3 object-cover"
/>
}
@@ -73,21 +73,21 @@ let make = (~note, ~userId, ~removeNoteCB) => {
}}
- {switch note |> CoachNote.author {
- | Some(user) => user |> User.name
+ {switch note->CoachNote.author {
+ | Some(user) => user->User.name
| None => "Deleted Coach"
- } |> str}
+ }->str}
- {switch note |> CoachNote.author {
- | Some(user) => user |> User.title
+ {switch note->CoachNote.author {
+ | Some(user) => user->User.title
| None => "Unknown"
- } |> str}
+ }->str}
{
- let showDeleteIcon = switch note |> CoachNote.author {
+ let showDeleteIcon = switch note->CoachNote.author {
| None => false
| Some(user) => User.id(user) == userId
}
@@ -99,10 +99,10 @@ let make = (~note, ~userId, ~removeNoteCB) => {
- {"on " ++ (note |> CoachNote.noteOn) |> str}
+ {"on " ++ (note->CoachNote.noteOn)->str}
CoachNote.note}
+ className="pt-1 text-sm" profile=Markdown.Permissive markdown={note->CoachNote.note}
/>
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNotes.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNotes.res
index 5926b087e1..f975dc8627 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNotes.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__CoachNotes.res
@@ -30,8 +30,8 @@ module CreateCoachNotesMutation = %graphql(`
let saveNote = (studentId, setState, state, addNoteCB) => {
setState(state => {...state, saving: true})
CreateCoachNotesMutation.make(~studentId, ~note=state.newNote, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
switch response["createCoachNote"]["coachNote"] {
| Some(note) =>
let newNote = CoachNote.makeFromJs(note)
@@ -41,17 +41,17 @@ let saveNote = (studentId, setState, state, addNoteCB) => {
}
Js.Promise.resolve()
})
- |> Js.Promise.catch(_error => {
+ ->Js.Promise.catch(_error => {
setState(state => {...state, saving: false})
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let updateCoachNoteCB = (setState, newNote) => setState(state => {...state, newNote: newNote})
let saveNoteButtonText = (title, iconClasses) =>
-
{title |> str}
+
{title->str}
@react.component
let make = (~studentId, ~coachNotes, ~addNoteCB, ~removeNoteCB, ~userId) => {
@@ -59,7 +59,7 @@ let make = (~studentId, ~coachNotes, ~addNoteCB, ~removeNoteCB, ~userId) => {
{
/>
String.length < 1 || state.saving}
+ disabled={state.newNote->String.length < 1 || state.saving}
onClick={_ => saveNote(studentId, setState, state, addNoteCB)}
className="btn btn-primary mt-2">
{state.saving
@@ -79,20 +79,20 @@ let make = (~studentId, ~coachNotes, ~addNoteCB, ~removeNoteCB, ~userId) => {
: saveNoteButtonText("Save Note", "")}
-
{"All Notes" |> str}
- {coachNotes |> ArrayUtils.isEmpty
+
{"All Notes"->str}
+ {coachNotes->ArrayUtils.isEmpty
?
-
{"No notes here!" |> str}
+
{"No notes here!"->str}
: React.null}
{coachNotes
- |> CoachNote.sort
- |> Array.map(note =>
-
CoachNote.id} note userId removeNoteCB />
+ ->CoachNote.sort
+ ->Array.map(note =>
+ CoachNote.id} note userId removeNoteCB />
)
- |> React.array}
+ ->React.array}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Course.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Course.res
index c5f64e7189..e81d5cbe01 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Course.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Course.res
@@ -4,5 +4,5 @@ let id = t => t.id
let decode = json => {
open Json.Decode
- {id: json |> field("id", string)}
+ {id: json->field("id", string)}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__EvaluationCriterion.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__EvaluationCriterion.res
index d24d11a10b..2075da9e88 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__EvaluationCriterion.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__EvaluationCriterion.res
@@ -19,6 +19,6 @@ let make = (~id, ~name, ~maxGrade, ~passGrade) => {
}
let makeFromJs = ecData =>
- ecData |> Js.Array.map(ec =>
+ ecData->Js.Array.map(ec =>
make(~id=ec["id"], ~name=ec["name"], ~maxGrade=ec["maxGrade"], ~passGrade=ec["passGrade"])
)
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Level.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Level.res
index 23e27df9cc..ad650cce5f 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Level.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Level.res
@@ -21,31 +21,31 @@ let teamsInLevel = t => t.teamsInLevel
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- name: json |> field("name", string),
- number: json |> field("number", int),
- studentsInLevel: json |> field("studentsInLevel", int),
- teamsInLevel: json |> field("teamsInLevel", int),
- unlocked: json |> field("unlocked", bool),
+ id: json->field("id", string),
+ name: json->field("name", string),
+ number: json->field("number", int),
+ studentsInLevel: json->field("studentsInLevel", int),
+ teamsInLevel: json->field("teamsInLevel", int),
+ unlocked: json->field("unlocked", bool),
}
}
let percentageStudents = (t, totalStudents) =>
float_of_int(t.studentsInLevel) /. float_of_int(totalStudents) *. 100.0
-let shortName = t => "L" ++ (t.number |> string_of_int)
+let shortName = t => "L" ++ (t.number->string_of_int)
-let sort = levels => levels |> ArrayUtils.copyAndSort((x, y) => x.number - y.number)
+let sort = levels => levels->ArrayUtils.copyAndSort((x, y) => x.number - y.number)
let unsafeLevelNumber = (levels, componentName, levelId) =>
"Level " ++
(levels
- |> ArrayUtils.unsafeFind(
+ ->ArrayUtils.unsafeFind(
l => l.id == levelId,
"Unable to find level with id: " ++ (levelId ++ (" in CoursesStudents__" ++ componentName)),
)
- |> number
- |> string_of_int)
+ ->number
+ ->string_of_int)
let levelsCompletedByAllStudents = levels => {
let rec aux = (completedLevels, levels) =>
@@ -59,6 +59,6 @@ let levelsCompletedByAllStudents = levels => {
}
}
- let ls = levels |> sort |> Array.to_list |> aux([])
- ls |> Array.length == (levels |> Array.length) ? [] : ls
+ let ls = levels->sort->Array.to_list->aux([])
+ ls->Array.length == (levels->Array.length) ? [] : ls
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__LevelDistribution.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__LevelDistribution.res
index 3b4ccd07a2..f3832eef0d 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__LevelDistribution.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__LevelDistribution.res
@@ -6,7 +6,7 @@ let str = React.string
let stylingForLevelPills = percentageStudents => {
let emptyStyle = ReactDOMRe.Style.make()
let styleWithWidth = ReactDOMRe.Style.make(
- ~width=(percentageStudents |> Js.Float.toString) ++ "%",
+ ~width=(percentageStudents->Js.Float.toString) ++ "%",
(),
)
if 0.0 <= percentageStudents && percentageStudents < 5.0 {
@@ -26,7 +26,7 @@ let stylingForLevelPills = percentageStudents => {
@react.component
let make = (~levels, ~selectLevelCB) => {
- let totalStudentsInCourse = levels |> Array.fold_left((x, y) => x + Level.studentsInLevel(y), 0)
+ let totalStudentsInCourse = levels->Array.fold_left((x, y) => x + Level.studentsInLevel(y), 0)
let completedLevels = Level.levelsCompletedByAllStudents(levels)
totalStudentsInCourse > 0
?
{
className="w-full pt-8 max-w-3xl mx-auto hidden md:block">
{levels
- |> Js.Array.filter(level => Level.number(level) != 0)
- |> Level.sort
- |> Array.map(level => {
+ ->Js.Array.filter(level => Level.number(level) != 0)
+ ->Level.sort
+ ->Array.map(level => {
let percentageStudents = Level.percentageStudents(level, totalStudentsInCourse)
let (pillClass, style, pillColor) = stylingForLevelPills(percentageStudents)
let tip =
-
{"Level: " ++ string_of_int(Level.number(level)) |> str}
-
{"Students: " ++ string_of_int(Level.studentsInLevel(level)) |> str}
+
{"Level: " ++ string_of_int(Level.number(level))->str}
+
{"Students: " ++ string_of_int(Level.studentsInLevel(level))->str}
{Level.studentsInLevel(level) != Level.teamsInLevel(level)
- ?
{"Teams: " ++ string_of_int(Level.teamsInLevel(level)) |> str}
+ ?
{"Teams: " ++ string_of_int(Level.teamsInLevel(level))->str}
: React.null}
{"Percentage: " ++ Js.Float.toFixedWithPrecision(percentageStudents, ~digits=1)
- |> str}
+ ->str}
string_of_int)}
+ ariaLabel={"Students in level " ++ (Level.number(level)->string_of_int)}
className={"level-distribution__container text-center relative " ++ pillClass}
style>
selectLevelCB(level)}
className={"level-distribution__pill hover:shadow-inner focus:shadow-inner relative cursor-pointer border-white text-xs leading-none text-center " ++ (
- completedLevels |> Array.mem(level)
+ completedLevels->Array.mem(level)
? "bg-yellow-300 text-yellow-900"
: Level.unlocked(level)
? pillColor
: "level-distribution__pill--locked cursor-default bg-gray-300" ++ " text-gray-800"
)}>
- {completedLevels |> Array.mem(level)
+ {completedLevels->Array.mem(level)
?
:
Level.unlocked
+ className={level->Level.unlocked
? ""
: "level-distribution__team-count-value"}>
- {level |> Level.teamsInLevel |> string_of_int |> str}
+ {level->Level.teamsInLevel->string_of_int->str}
- {level |> Level.unlocked
+ {level->Level.unlocked
? React.null
:
@@ -88,7 +88,7 @@ let make = (~levels, ~selectLevelCB) => {
})
- |> React.array}
+ ->React.array}
: React.null
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Root.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Root.res
index 07d8d5d5fe..654591af5c 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Root.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Root.res
@@ -83,7 +83,7 @@ let reducer = (state, action) =>
| UpdateFilterString(filterString) => {...state, filterString: filterString}
| LoadTeams(endCursor, hasNextPage, newTeams) =>
let updatedTeams = switch state.loading {
- | LoadingMore => newTeams |> Array.append(state.teams |> Teams.toArray)
+ | LoadingMore => newTeams->Array.append(state.teams->Teams.toArray)
| Reloading => newTeams
| NotLoading => newTeams
}
@@ -127,15 +127,15 @@ module TeamsQuery = %graphql(`
`)
let getTeams = (send, courseId, cursor, filter) => {
- let levelId = filter.level |> OptionUtils.map(Level.id)
- let coachId = filter.coach |> OptionUtils.map(Coach.id)
+ let levelId = filter.level->OptionUtils.map(Level.id)
+ let coachId = filter.coach->OptionUtils.map(Coach.id)
TeamsQuery.make(~courseId, ~after=?cursor, ~levelId?, ~coachId?, ~search=?filter.nameOrEmail, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
let newTeams = switch response["teams"]["nodes"] {
| None => []
- | Some(teamsArray) => teamsArray |> TeamInfo.makeArrayFromJs
+ | Some(teamsArray) => teamsArray->TeamInfo.makeArrayFromJs
}
send(
@@ -148,10 +148,10 @@ let getTeams = (send, courseId, cursor, filter) => {
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
-let applicableLevels = levels => levels |> Js.Array.filter(level => Level.number(level) != 0)
+let applicableLevels = levels => levels->Js.Array.filter(level => Level.number(level) != 0)
module Selectable = {
type t =
@@ -161,28 +161,28 @@ module Selectable = {
let label = t =>
switch t {
- | Level(level) => Some("Level " ++ (level |> Level.number |> string_of_int))
+ | Level(level) => Some("Level " ++ (level->Level.number->string_of_int))
| AssignedToCoach(_) => Some("Assigned to")
| NameOrEmail(_) => Some("Name or Email")
}
let value = t =>
switch t {
- | Level(level) => level |> Level.name
+ | Level(level) => level->Level.name
| AssignedToCoach(coach, currentCoachId) =>
- coach |> Coach.id == currentCoachId ? "Me" : coach |> Coach.name
+ coach->Coach.id == currentCoachId ? "Me" : coach->Coach.name
| NameOrEmail(search) => search
}
let searchString = t =>
switch t {
| Level(level) =>
- "level " ++ ((level |> Level.number |> string_of_int) ++ (" " ++ (level |> Level.name)))
+ "level " ++ ((level->Level.number->string_of_int) ++ (" " ++ (level->Level.name)))
| AssignedToCoach(coach, currentCoachId) =>
- if coach |> Coach.id == currentCoachId {
- (coach |> Coach.name) ++ " assigned to me"
+ if coach->Coach.id == currentCoachId {
+ (coach->Coach.name) ++ " assigned to me"
} else {
- "assigned to " ++ (coach |> Coach.name)
+ "assigned to " ++ (coach->Coach.name)
}
| NameOrEmail(search) => search
}
@@ -198,50 +198,50 @@ module Multiselect = MultiselectDropdown.Make(Selectable)
let unselected = (levels, coaches, currentCoachId, state) => {
let unselectedLevels =
levels
- |> Js.Array.filter(level =>
- state.filter.level |> OptionUtils.mapWithDefault(
- selectedLevel => level |> Level.id != (selectedLevel |> Level.id),
+ ->Js.Array.filter(level =>
+ state.filter.level->OptionUtils.mapWithDefault(
+ selectedLevel => level->Level.id != (selectedLevel->Level.id),
true,
)
)
- |> Array.map(Selectable.level)
+ ->Array.map(Selectable.level)
let unselectedCoaches =
coaches
- |> Js.Array.filter(coach =>
- state.filter.coach |> OptionUtils.mapWithDefault(
- selectedCoach => coach |> Coach.id != Coach.id(selectedCoach),
+ ->Js.Array.filter(coach =>
+ state.filter.coach->OptionUtils.mapWithDefault(
+ selectedCoach => coach->Coach.id != Coach.id(selectedCoach),
true,
)
)
- |> Array.map(coach => Selectable.assignedToCoach(coach, currentCoachId))
+ ->Array.map(coach => Selectable.assignedToCoach(coach, currentCoachId))
- let trimmedFilterString = state.filterString |> String.trim
+ let trimmedFilterString = state.filterString->String.trim
let nameOrEmail = trimmedFilterString == "" ? [] : [Selectable.nameOrEmail(trimmedFilterString)]
- unselectedLevels |> Array.append(unselectedCoaches) |> Array.append(nameOrEmail)
+ unselectedLevels->Array.append(unselectedCoaches)->Array.append(nameOrEmail)
}
let selected = (state, currentCoachId) => {
let selectedLevel =
- state.filter.level |> OptionUtils.mapWithDefault(
+ state.filter.level->OptionUtils.mapWithDefault(
selectedLevel => [Selectable.level(selectedLevel)],
[],
)
let selectedCoach =
- state.filter.coach |> OptionUtils.mapWithDefault(
+ state.filter.coach->OptionUtils.mapWithDefault(
selectedCoach => [Selectable.assignedToCoach(selectedCoach, currentCoachId)],
[],
)
let selectedSearchString =
- state.filter.nameOrEmail |> OptionUtils.mapWithDefault(
+ state.filter.nameOrEmail->OptionUtils.mapWithDefault(
nameOrEmail => [Selectable.nameOrEmail(nameOrEmail)],
[],
)
- selectedLevel |> Array.append(selectedCoach) |> Array.append(selectedSearchString)
+ selectedLevel->Array.append(selectedCoach)->Array.append(selectedSearchString)
}
let onSelectFilter = (send, selectable) =>
@@ -267,24 +267,24 @@ let filterPlaceholder = state =>
let restoreFilterNotice = (send, currentCoach, message) =>
- {message |> str}
+ {message->str}
send(SelectCoach(currentCoach))}>
- {"Assigned to: Me" |> str}
+ {"Assigned to: Me"->str}
let restoreAssignedToMeFilter = (state, send, currentTeamCoach) =>
- currentTeamCoach |> OptionUtils.mapWithDefault(currentCoach =>
+ currentTeamCoach->OptionUtils.mapWithDefault(currentCoach =>
switch state.filter.coach {
| None => restoreFilterNotice(send, currentCoach, "Now showing all students in this course.")
- | Some(selectedCoach) if selectedCoach |> Coach.id == Coach.id(currentCoach) => React.null
+ | Some(selectedCoach) if selectedCoach->Coach.id == Coach.id(currentCoach) => React.null
| Some(selectedCoach) =>
restoreFilterNotice(
send,
currentCoach,
- "Now showing students assigned to " ++ ((selectedCoach |> Coach.name) ++ "."),
+ "Now showing students assigned to " ++ ((selectedCoach->Coach.name) ++ "."),
)
}
, React.null)
@@ -303,14 +303,14 @@ let computeInitialState = currentTeamCoach => {
@react.component
let make = (~levels, ~course, ~userId, ~teamCoaches, ~currentCoach) => {
let (currentTeamCoach, _) = React.useState(() =>
- teamCoaches->Belt.Array.some(coach => coach |> Coach.id == (currentCoach |> Coach.id))
+ teamCoaches->Belt.Array.some(coach => coach->Coach.id == (currentCoach->Coach.id))
? Some(currentCoach)
: None
)
let (state, send) = React.useReducerWithMapState(reducer, currentTeamCoach, computeInitialState)
- let courseId = course |> Course.id
+ let courseId = course->Course.id
let url = ReasonReactRouter.useUrl()
@@ -335,8 +335,8 @@ let make = (~levels, ~course, ~userId, ~teamCoaches, ~currentCoach) => {
Coach.id, state)}
- selected={selected(state, currentCoach |> Coach.id)}
+ unselected={unselected(levels, teamCoaches, currentCoach->Coach.id, state)}
+ selected={selected(state, currentCoach->Coach.id)}
onSelect={onSelectFilter(send)}
onDeselect={onDeselectFilter(send)}
value=state.filterString
@@ -361,7 +361,7 @@ let make = (~levels, ~course, ~userId, ~teamCoaches, ~currentCoach) => {
send(BeginLoadingMore)
getTeams(send, courseId, Some(cursor), state.filter)
}}>
- {"Load More..." |> str}
+ {"Load More..."->str}
| Reloading => React.null
}}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__StudentDetails.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__StudentDetails.res
index 3f04c2c077..bc01411727 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__StudentDetails.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__StudentDetails.res
@@ -20,45 +20,45 @@ type t = {
let team = t => t.team
-let student = t => t.team |> CoursesStudents__TeamInfo.studentWithId(t.id)
+let student = t => t.team->CoursesStudents__TeamInfo.studentWithId(t.id)
-let name = t => t |> student |> CoursesStudents__TeamInfo.studentName
+let name = t => t->student->CoursesStudents__TeamInfo.studentName
-let title = t => t |> student |> CoursesStudents__TeamInfo.studentTitle
+let title = t => t->student->CoursesStudents__TeamInfo.studentTitle
let email = t => t.email
-let levelId = t => t.team |> CoursesStudents__TeamInfo.levelId
+let levelId = t => t.team->CoursesStudents__TeamInfo.levelId
let phone = t => t.phone
let socialLinks = t => t.socialLinks
-let avatarUrl = t => t |> student |> CoursesStudents__TeamInfo.studentAvatarUrl
+let avatarUrl = t => t->student->CoursesStudents__TeamInfo.studentAvatarUrl
let coachNotes = t => t.coachNotes
-let teamCoachUserIds = t => t.team |> CoursesStudents__TeamInfo.coachUserIds
+let teamCoachUserIds = t => t.team->CoursesStudents__TeamInfo.coachUserIds
let makeAverageGrade = gradesData =>
- gradesData |> Js.Array.map(gradeData => {
+ gradesData->Js.Array.map(gradeData => {
evaluationCriterionId: gradeData["evaluationCriterionId"],
grade: gradeData["averageGrade"],
})
-let totalTargets = t => t.totalTargets |> float_of_int
+let totalTargets = t => t.totalTargets->float_of_int
let gradeAsPercentage = (
averageGrade: averageGrade,
evaluationCriterion: CoursesStudents__EvaluationCriterion.t,
) => {
- let maxGrade = evaluationCriterion.maxGrade |> float_of_int
- averageGrade.grade /. maxGrade *. 100.0 |> int_of_float |> string_of_int
+ let maxGrade = evaluationCriterion.maxGrade->float_of_int
+ averageGrade.grade /. maxGrade *. 100.0->int_of_float->string_of_int
}
-let targetsCompleted = t => t.targetsCompleted |> float_of_int
+let targetsCompleted = t => t.targetsCompleted->float_of_int
-let quizzesAttempted = t => t.quizScores |> Array.length |> string_of_int
+let quizzesAttempted = t => t.quizScores->Array.length->string_of_int
let evaluationCriteria = t => t.evaluationCriteria
@@ -69,7 +69,7 @@ let completedLevelIds = t => t.completedLevelIds
let gradeValue = averageGrade => averageGrade.grade
let evaluationCriterionForGrade = (grade, evaluationCriteria, componentName) =>
- evaluationCriteria |> ArrayUtils.unsafeFind(
+ evaluationCriteria->ArrayUtils.unsafeFind(
ec => CoursesStudents__EvaluationCriterion.id(ec) == grade.evaluationCriterionId,
"Unable to find evaluation criterion with id: " ++
(grade.evaluationCriterionId ++
@@ -82,43 +82,43 @@ let addNewNote = (note, t) => {
}
let removeNote = (noteId, t) => {
- let notes = t.coachNotes |> Js.Array.filter(note => CoursesStudents__CoachNote.id(note) != noteId)
+ let notes = t.coachNotes->Js.Array.filter(note => CoursesStudents__CoachNote.id(note) != noteId)
{...t, coachNotes: notes}
}
let computeAverageQuizScore = quizScores => {
let sumOfPercentageScores =
quizScores
- |> Array.map(quizScore => {
- let fractionArray = quizScore |> String.split_on_char('/') |> Array.of_list
+ ->Array.map(quizScore => {
+ let fractionArray = quizScore->String.split_on_char('/')->Array.of_list
let (numerator, denominator) = (
- fractionArray[0] |> float_of_string,
- fractionArray[1] |> float_of_string,
+ fractionArray[0]->float_of_string,
+ fractionArray[1]->float_of_string,
)
numerator /. denominator *. 100.0
})
- |> Js.Array.reduce((a, b) => a +. b, 0.0)
- sumOfPercentageScores /. (quizScores |> Array.length |> float_of_int)
+ ->Js.Array.reduce((a, b) => a +. b, 0.0)
+ sumOfPercentageScores /. (quizScores->Array.length->float_of_int)
}
let averageQuizScore = t =>
- t.quizScores |> ArrayUtils.isEmpty ? None : Some(computeAverageQuizScore(t.quizScores))
+ t.quizScores->ArrayUtils.isEmpty ? None : Some(computeAverageQuizScore(t.quizScores))
let makeFromJs = (id, studentDetails) => {
id: id,
email: studentDetails["email"],
phone: studentDetails["phone"],
- coachNotes: studentDetails["coachNotes"] |> Js.Array.map(note =>
- note |> CoursesStudents__CoachNote.makeFromJs
+ coachNotes: studentDetails["coachNotes"]->Js.Array.map(note =>
+ note->CoursesStudents__CoachNote.makeFromJs
),
- evaluationCriteria: studentDetails["evaluationCriteria"] |> CoursesStudents__EvaluationCriterion.makeFromJs,
+ evaluationCriteria: studentDetails["evaluationCriteria"]->CoursesStudents__EvaluationCriterion.makeFromJs,
socialLinks: studentDetails["socialLinks"],
totalTargets: studentDetails["totalTargets"],
targetsCompleted: studentDetails["targetsCompleted"],
quizScores: studentDetails["quizScores"],
- averageGrades: studentDetails["averageGrades"] |> makeAverageGrade,
+ averageGrades: studentDetails["averageGrades"]->makeAverageGrade,
completedLevelIds: studentDetails["completedLevelIds"],
- team: studentDetails["team"] |> CoursesStudents__TeamInfo.makeFromJS,
+ team: studentDetails["team"]->CoursesStudents__TeamInfo.makeFromJS,
}
-let teamHasManyStudents = t => t.team |> CoursesStudents__TeamInfo.students |> Array.length > 1
+let teamHasManyStudents = t => t.team->CoursesStudents__TeamInfo.students->Array.length > 1
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__StudentOverlay.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__StudentOverlay.res
index c80f8a1c3e..d893793281 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__StudentOverlay.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__StudentOverlay.res
@@ -73,18 +73,18 @@ module StudentDetailsQuery = %graphql(`
let updateStudentDetails = (setState, studentId, details) =>
setState(state => {
...state,
- studentData: Loaded(details |> StudentDetails.makeFromJs(studentId)),
+ studentData: Loaded(details->StudentDetails.makeFromJs(studentId)),
})
let getStudentDetails = (studentId, setState, ()) => {
setState(state => {...state, studentData: Loading})
StudentDetailsQuery.make(~studentId, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
- response["studentDetails"] |> updateStudentDetails(setState, studentId)
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
+ response["studentDetails"]->updateStudentDetails(setState, studentId)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
None
}
@@ -104,21 +104,21 @@ let doughnutChart = (color, percentage) =>
d="M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"
/>
- {percentage ++ "%" |> str}
+ {percentage ++ "%"->str}
let targetsCompletionStatus = (targetsCompleted, totalTargets) => {
let targetCompletionPercent =
- targetsCompleted /. totalTargets *. 100.0 |> int_of_float |> string_of_int
+ targetsCompleted /. totalTargets *. 100.0->int_of_float->string_of_int
{doughnutChart("purple", targetCompletionPercent)}
-
{"Total Targets Completed" |> str}
+
{"Total Targets Completed"->str}
- {(targetsCompleted |> int_of_float |> string_of_int) ++
+ {(targetsCompleted->int_of_float->string_of_int) ++
("/" ++
- ((totalTargets |> int_of_float |> string_of_int) ++ " Targets")) |> str}
+ ((totalTargets->int_of_float->string_of_int) ++ " Targets"))->str}
@@ -129,10 +129,10 @@ let quizPerformanceChart = (averageQuizScore, quizzesAttempted) =>
| Some(score) =>
- {doughnutChart("pink", score |> int_of_float |> string_of_int)}
-
{"Average Quiz Score" |> str}
+ {doughnutChart("pink", score->int_of_float->string_of_int)}
+
{"Average Quiz Score"->str}
- {quizzesAttempted ++ " Quizzes Attempted" |> str}
+ {quizzesAttempted ++ " Quizzes Attempted"->str}
@@ -144,18 +144,18 @@ let averageGradeCharts = (
averageGrades: array,
) =>
averageGrades
- |> Array.map(grade => {
+ ->Array.map(grade => {
let criterion = StudentDetails.evaluationCriterionForGrade(
grade,
evaluationCriteria,
"CoursesStudents__StudentOverlay",
)
- let passGrade = criterion |> CoursesStudents__EvaluationCriterion.passGrade |> float_of_int
- let averageGrade = grade |> StudentDetails.gradeValue
+ let passGrade = criterion->CoursesStudents__EvaluationCriterion.passGrade->float_of_int
+ let averageGrade = grade->StudentDetails.gradeValue
CoursesStudents__EvaluationCriterion.id)}
- key={criterion |> CoursesStudents__EvaluationCriterion.id}
+ (criterion->CoursesStudents__EvaluationCriterion.id)}
+ key={criterion->CoursesStudents__EvaluationCriterion.id}
className="flex w-full lg:w-1/2 px-2 mt-2">
@@ -179,33 +179,33 @@ let averageGradeCharts = (
/>
- {(grade.grade |> Js.Float.toString) ++ ("/" ++ (criterion.maxGrade |> string_of_int))
- |> str}
+ {(grade.grade->Js.Float.toString) ++ ("/" ++ (criterion.maxGrade->string_of_int))
+ ->str}
- {criterion |> CoursesStudents__EvaluationCriterion.name |> str}
+ {criterion->CoursesStudents__EvaluationCriterion.name->str}
})
- |> React.array
+ ->React.array
let test = (value, url) => {
let tester = Js.Re.fromString(value)
- url |> Js.Re.test_(tester)
+ url->Js.Re.test_(tester)
}
let socialLinkIconClass = url =>
switch url {
- | url if url |> test("twitter") => "fab fa-twitter"
- | url if url |> test("facebook") => "fab fa-facebook-f"
- | url if url |> test("instagram") => "fab fa-instagram"
- | url if url |> test("youtube") => "fab fa-youtube"
- | url if url |> test("linkedin") => "fab fa-linkedin"
- | url if url |> test("reddit") => "fab fa-reddit"
- | url if url |> test("flickr") => "fab fa-flickr"
- | url if url |> test("github") => "fab fa-github"
+ | url if url->test("twitter") => "fab fa-twitter"
+ | url if url->test("facebook") => "fab fa-facebook-f"
+ | url if url->test("instagram") => "fab fa-instagram"
+ | url if url->test("youtube") => "fab fa-youtube"
+ | url if url->test("linkedin") => "fab fa-linkedin"
+ | url if url->test("reddit") => "fab fa-reddit"
+ | url if url->test("flickr") => "fab fa-flickr"
+ | url if url->test("github") => "fab fa-github"
| _unknownUrl => "fas fa-users"
}
@@ -213,16 +213,16 @@ let showSocialLinks = socialLinks =>
let personalInfo = studentDetails =>
@@ -230,19 +230,19 @@ let personalInfo = studentDetails =>
-
{studentDetails |> StudentDetails.email |> str}
+
{studentDetails->StudentDetails.email->str}
- {switch studentDetails |> StudentDetails.phone {
+ {switch studentDetails->StudentDetails.phone {
| Some(phone) =>
-
{phone |> str}
+
{phone->str}
| None => React.null
}}
{
- let socialLinks = studentDetails |> StudentDetails.socialLinks
- socialLinks |> ArrayUtils.isNotEmpty ? showSocialLinks(socialLinks) : React.null
+ let socialLinks = studentDetails->StudentDetails.socialLinks
+ socialLinks->ArrayUtils.isNotEmpty ? showSocialLinks(socialLinks) : React.null
}
@@ -260,25 +260,25 @@ let studentLevelClasses = (levelNumber, levelCompleted, currentLevelNumber) => {
}
let levelProgressBar = (levelId, levels, levelsCompleted) => {
- let applicableLevels = levels |> Js.Array.filter(level => Level.number(level) != 0)
+ let applicableLevels = levels->Js.Array.filter(level => Level.number(level) != 0)
let courseCompleted =
- applicableLevels |> Array.for_all(level => levelsCompleted |> Array.mem(level |> Level.id))
+ applicableLevels->Array.for_all(level => levelsCompleted->Array.mem(level->Level.id))
let currentLevelNumber =
applicableLevels
- |> ArrayUtils.unsafeFind(
+ ->ArrayUtils.unsafeFind(
level => Level.id(level) == levelId,
"Unable to find level with id" ++ (levelId ++ "in StudentOverlay"),
)
- |> Level.number
+ ->Level.number
-
{"Level Progress" |> str}
+
{"Level Progress"->str}
{courseCompleted
?
- {`🎉` |> str} {"Course Completed!" |> str}
+ {`🎉`->str} {"Course Completed!"->str}
: React.null}
@@ -288,21 +288,21 @@ let levelProgressBar = (levelId, levels, levelsCompleted) => {
courseCompleted ? "student-overlay__student-level-progress--completed" : ""
)}>
{applicableLevels
- |> Level.sort
- |> Array.map(level => {
- let levelNumber = level |> Level.number
- let levelCompleted = levelsCompleted |> Array.mem(level |> Level.id)
+ ->Level.sort
+ ->Array.map(level => {
+ let levelNumber = level->Level.number
+ let levelCompleted = levelsCompleted->Array.mem(level->Level.id)
Level.id}
+ key={level->Level.id}
className={"flex-1 student-overlay__student-level " ++
studentLevelClasses(levelNumber, levelCompleted, currentLevelNumber)}>
- {levelNumber |> string_of_int |> str}
+ {levelNumber->string_of_int->str}
})
- |> React.array}
+ ->React.array}
@@ -324,30 +324,30 @@ let userInfo = (~key, ~avatarUrl, ~name, ~title) =>
{CoursesStudents__TeamCoaches.avatar(avatarUrl, name)}
-
{name |> str}
-
{title |> str}
+
{name->str}
+
{title->str}
let coachInfo = (teamCoaches, studentDetails) => {
- let coaches = studentDetails |> StudentDetails.team |> TeamInfo.coaches(teamCoaches)
+ let coaches = studentDetails->StudentDetails.team->TeamInfo.coaches(teamCoaches)
let title =
- studentDetails |> StudentDetails.teamHasManyStudents ? "Team Coaches" : "Personal Coaches"
+ studentDetails->StudentDetails.teamHasManyStudents ? "Team Coaches" : "Personal Coaches"
- coaches |> ArrayUtils.isNotEmpty
+ coaches->ArrayUtils.isNotEmpty
?
-
{title |> str}
+ {title->str}
{coaches
- |> Array.map(coach =>
+ ->Array.map(coach =>
userInfo(
- ~key=coach |> Coach.userId,
- ~avatarUrl=coach |> Coach.avatarUrl,
- ~name=coach |> Coach.name,
- ~title=coach |> Coach.title,
+ ~key=coach->Coach.userId,
+ ~avatarUrl=coach->Coach.avatarUrl,
+ ~name=coach->Coach.name,
+ ~title=coach->Coach.title,
)
)
- |> React.array}
+ ->React.array}
: React.null
}
@@ -355,58 +355,58 @@ let coachInfo = (teamCoaches, studentDetails) => {
let navigateToStudent = (setState, _event) => setState(_ => initialState)
let otherTeamMembers = (setState, studentId, studentDetails) =>
- if studentDetails |> StudentDetails.teamHasManyStudents {
+ if studentDetails->StudentDetails.teamHasManyStudents {
-
{"Other Team Members" |> str}
+ {"Other Team Members"->str}
{studentDetails
- |> StudentDetails.team
- |> TeamInfo.otherStudents(studentId)
- |> Array.map(student => {
- let path = "/students/" ++ ((student |> TeamInfo.studentId) ++ "/report")
+ ->StudentDetails.team
+ ->TeamInfo.otherStudents(studentId)
+ ->Array.map(student => {
+ let path = "/students/" ++ ((student->TeamInfo.studentId) ++ "/report")
TeamInfo.studentId}>
+ key={student->TeamInfo.studentId}>
{userInfo(
- ~key=student |> TeamInfo.studentId,
- ~avatarUrl=student |> TeamInfo.studentAvatarUrl,
- ~name=student |> TeamInfo.studentName,
- ~title=student |> TeamInfo.studentTitle,
+ ~key=student->TeamInfo.studentId,
+ ~avatarUrl=student->TeamInfo.studentAvatarUrl,
+ ~name=student->TeamInfo.studentName,
+ ~title=student->TeamInfo.studentTitle,
)}
})
- |> React.array}
+ ->React.array}
} else {
React.null
}
let inactiveWarning = teamInfo => {
- let warning = switch (teamInfo |> TeamInfo.droppedOutAt, teamInfo |> TeamInfo.accessEndsAt) {
+ let warning = switch (teamInfo->TeamInfo.droppedOutAt, teamInfo->TeamInfo.accessEndsAt) {
| (Some(droppedOutAt), _) =>
Some(
"This student dropped out of the course on " ++
- ((droppedOutAt |> DateTime.format(DateTime.OnlyDate)) ++
+ ((droppedOutAt->DateTime.format(DateTime.OnlyDate)) ++
"."),
)
| (None, Some(accessEndsAt)) =>
- accessEndsAt |> DateFns.isPast
+ accessEndsAt->DateFns.isPast
? Some(
"This student's access to the course ended on " ++
- ((accessEndsAt |> DateTime.format(DateTime.OnlyDate)) ++
+ ((accessEndsAt->DateTime.format(DateTime.OnlyDate)) ++
"."),
)
: None
| (None, None) => None
}
- warning |> OptionUtils.mapWithDefault(
+ warning->OptionUtils.mapWithDefault(
warning =>
- {warning |> str}
+ {warning->str}
,
React.null,
)
@@ -438,46 +438,46 @@ let make = (~courseId, ~studentId, ~levels, ~userId, ~teamCoaches) => {
- {switch studentDetails |> StudentDetails.avatarUrl {
+ {switch studentDetails->StudentDetails.avatarUrl {
| Some(avatarUrl) =>

| None =>
-
StudentDetails.name} className="object-cover" />
+ StudentDetails.name} className="object-cover" />
}}
- {studentDetails |> StudentDetails.name |> str}
+ {studentDetails->StudentDetails.name->str}
- {studentDetails |> StudentDetails.title |> str}
+ {studentDetails->StudentDetails.title->str}
{personalInfo(studentDetails)}
- {inactiveWarning(studentDetails |> StudentDetails.team)}
+ {inactiveWarning(studentDetails->StudentDetails.team)}
{levelProgressBar(
- studentDetails |> StudentDetails.levelId,
+ studentDetails->StudentDetails.levelId,
levels,
- studentDetails |> StudentDetails.completedLevelIds,
+ studentDetails->StudentDetails.completedLevelIds,
)}
-
{"Targets Overview" |> str}
+
{"Targets Overview"->str}
{targetsCompletionStatus(
- studentDetails |> StudentDetails.targetsCompleted,
- studentDetails |> StudentDetails.totalTargets,
+ studentDetails->StudentDetails.targetsCompleted,
+ studentDetails->StudentDetails.totalTargets,
)}
{quizPerformanceChart(
- studentDetails |> StudentDetails.averageQuizScore,
- studentDetails |> StudentDetails.quizzesAttempted,
+ studentDetails->StudentDetails.averageQuizScore,
+ studentDetails->StudentDetails.quizzesAttempted,
)}
- {studentDetails |> StudentDetails.averageGrades |> ArrayUtils.isNotEmpty
+ {studentDetails->StudentDetails.averageGrades->ArrayUtils.isNotEmpty
?
-
{"Average Grades" |> str}
+
{"Average Grades"->str}
{averageGradeCharts(
- studentDetails |> StudentDetails.evaluationCriteria,
- studentDetails |> StudentDetails.averageGrades,
+ studentDetails->StudentDetails.evaluationCriteria,
+ studentDetails->StudentDetails.averageGrades,
)}
@@ -497,7 +497,7 @@ let make = (~courseId, ~studentId, ~levels, ~userId, ~teamCoaches) => {
| Notes => "border-b-3 border-primary-500 text-primary-500 -mb-px"
| Submissions => "hover:bg-gray-200 hover:text-gray-900"
}}>
- {"Notes" |> str}
+ {"Notes"->str}
setSelectedTab(Submissions, setState)}
@@ -506,7 +506,7 @@ let make = (~courseId, ~studentId, ~levels, ~userId, ~teamCoaches) => {
| Submissions => "border-b-3 border-primary-500 text-primary-500 -mb-px"
| Notes => "hover:bg-gray-200 hover:text-gray-900"
}}>
- {"Submissions" |> str}
+ {"Submissions"->str}
@@ -515,7 +515,7 @@ let make = (~courseId, ~studentId, ~levels, ~userId, ~teamCoaches) => {
| Notes =>
StudentDetails.coachNotes}
+ coachNotes={studentDetails->StudentDetails.coachNotes}
addNoteCB={addNoteCB(setState, studentDetails)}
userId
removeNoteCB={removeNoteCB(setState, studentDetails)}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Submission.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Submission.res
index 2430d3966f..3feca58dca 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Submission.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__Submission.res
@@ -21,8 +21,8 @@ let levelId = t => t.levelId
let title = t => t.title
let sort = submissions =>
- submissions |> ArrayUtils.copyAndSort((x, y) =>
- DateFns.differenceInSeconds(y.createdAt, x.createdAt) |> int_of_float
+ submissions->ArrayUtils.copyAndSort((x, y) =>
+ DateFns.differenceInSeconds(y.createdAt, x.createdAt)->int_of_float
)
let failed = t =>
@@ -31,15 +31,15 @@ let failed = t =>
| None => true
}
-let createdAtPretty = t => t.createdAt |> DateFns.format("MMMM D, YYYY")
+let createdAtPretty = t => t.createdAt->DateFns.format("MMMM D, YYYY")
let makeFromJs = submissions =>
- submissions |> Js.Array.map(submission =>
+ submissions->Js.Array.map(submission =>
switch submission {
| Some(submission) =>
- let createdAt = submission["createdAt"] |> Json.Decode.string |> DateFns.parseString
+ let createdAt = submission["createdAt"]->Json.Decode.string->DateFns.parseString
let passedAt = switch submission["passedAt"] {
- | Some(passedAt) => Some(passedAt |> Json.Decode.string |> DateFns.parseString)
+ | Some(passedAt) => Some(passedAt->Json.Decode.string->DateFns.parseString)
| None => None
}
list{
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__SubmissionsList.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__SubmissionsList.res
index 0cc571c7d3..f5dbfac861 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__SubmissionsList.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__SubmissionsList.res
@@ -38,8 +38,8 @@ let updateStudentSubmissions = (
let updatedSubmissions = Array.append(
switch nodes {
| None => []
- | Some(submissionsArray) => submissionsArray |> Submission.makeFromJs
- } |> ArrayUtils.flatten,
+ | Some(submissionsArray) => submissionsArray->Submission.makeFromJs
+ }->ArrayUtils.flatten,
submissions,
)
@@ -60,9 +60,9 @@ let getStudentSubmissions = (studentId, cursor, setState, submissions, updateSub
| Some(cursor) => StudentSubmissionsQuery.make(~studentId, ~after=cursor, ())
| None => StudentSubmissionsQuery.make(~studentId, ())
}
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
- response["studentSubmissions"]["nodes"] |> updateStudentSubmissions(
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
+ response["studentSubmissions"]["nodes"]->updateStudentSubmissions(
setState,
updateSubmissionsCB,
response["studentSubmissions"]["pageInfo"]["endCursor"],
@@ -71,70 +71,70 @@ let getStudentSubmissions = (studentId, cursor, setState, submissions, updateSub
)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let showSubmissionStatus = failed =>
failed
?
- {"Failed" |> str}
+ {"Failed"->str}
:
- {"Passed" |> str}
+ {"Passed"->str}
let submissionCardClasses = submission =>
"flex flex-col md:flex-row items-start md:items-center justify-between bg-white border-l-3 p-3 md:py-6 md:px-5 mt-4 cursor-pointer rounded-r-lg shadow hover:border-primary-500 hover:text-primary-500 hover:shadow-md " ++ (
- submission |> Submission.failed ? "border-red-500" : "border-green-500"
+ submission->Submission.failed ? "border-red-500" : "border-green-500"
)
let showSubmission = (submissions, levels) =>
let showSubmissions = (submissions, levels) =>
- submissions |> ArrayUtils.isEmpty
+ submissions->ArrayUtils.isEmpty
?
- {"No Reviewed Submission" |> str}
+ {"No Reviewed Submission"->str}
@@ -170,7 +170,7 @@ let make = (~studentId, ~levels, ~submissions, ~updateSubmissionsCB) => {
submissions,
updateSubmissionsCB,
)}>
- {"Load More..." |> str}
+ {"Load More..."->str}
}
| FullyLoaded(submissions) => showSubmissions(submissions, levels)
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamCoaches.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamCoaches.res
index 5c5b2843eb..9f217d4543 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamCoaches.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamCoaches.res
@@ -28,20 +28,20 @@ let make = (
~className,
~coaches,
) =>
- if coaches |> ArrayUtils.isNotEmpty {
+ if coaches->ArrayUtils.isNotEmpty {
let listedCoaches =
- coaches |> Array.length <= 4 ? coaches : coaches |> Js.Array.slice(~start=0, ~end_=3)
+ coaches->Array.length <= 4 ? coaches : coaches->Js.Array.slice(~start=0, ~end_=3)
- let otherCoaches = if coaches |> Array.length > 4 {
+ let otherCoaches = if coaches->Array.length > 4 {
let names =
coaches
- |> Js.Array.sliceFrom(3)
- |> Js.Array.map(coach =>
-
UserProxy.userId}> {coach |> UserProxy.name |> str}
+ ->Js.Array.sliceFrom(3)
+ ->Js.Array.map(coach =>
+
UserProxy.userId}> {coach->UserProxy.name->str}
)
- |> React.array
+ ->React.array
- let count = (coaches |> Array.length) - 3
+ let count = (coaches->Array.length) - 3
Some((names, count))
} else {
None
@@ -51,25 +51,25 @@ let make = (
title
{listedCoaches
- |> Array.map(coach =>
+ ->Array.map(coach =>
UserProxy.name |> str}
+ tip={coach->UserProxy.name->str}
className="-mr-1"
- key={coach |> UserProxy.userId}>
+ key={coach->UserProxy.userId}>
{avatar(
~size=(defaultAvatarSize, mdAvatarSize),
- coach |> UserProxy.avatarUrl,
- coach |> UserProxy.name,
+ coach->UserProxy.avatarUrl,
+ coach->UserProxy.name,
)}
)
- |> React.array}
- {otherCoaches |> OptionUtils.mapWithDefault(
+ ->React.array}
+ {otherCoaches->OptionUtils.mapWithDefault(
((names, count)) =>
string_of_int)}
+ name={"+ " ++ (count->string_of_int)}
className={avatarClasses((defaultAvatarSize, mdAvatarSize))}
colors=("#EEE", "#000")
/>
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamInfo.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamInfo.res
index c936cb8d25..d80a0b04d0 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamInfo.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamInfo.res
@@ -39,7 +39,7 @@ let droppedOutAt = t => t.droppedOutAt
let accessEndsAt = t => t.accessEndsAt
let studentWithId = (studentId, t) =>
- t.students |> ArrayUtils.unsafeFind(
+ t.students->ArrayUtils.unsafeFind(
(student: student) => student.id == studentId,
"Could not find student with ID " ++ (studentId ++ (" in team with ID " ++ t.id)),
)
@@ -63,7 +63,7 @@ let make = (~id, ~name, ~levelId, ~students, ~coachUserIds, ~droppedOutAt, ~acce
let makeFromJS = teamDetails => {
let students =
- teamDetails["students"] |> Array.map(student =>
+ teamDetails["students"]->Array.map(student =>
makeStudent(
~id=student["id"],
~name=student["name"],
@@ -78,8 +78,8 @@ let makeFromJS = teamDetails => {
~levelId=teamDetails["levelId"],
~students,
~coachUserIds=teamDetails["coachUserIds"],
- ~droppedOutAt=teamDetails["droppedOutAt"] |> OptionUtils.map(DateTime.decode),
- ~accessEndsAt=teamDetails["accessEndsAt"] |> OptionUtils.map(DateTime.decode),
+ ~droppedOutAt=teamDetails["droppedOutAt"]->OptionUtils.map(DateTime.decode),
+ ~accessEndsAt=teamDetails["accessEndsAt"]->OptionUtils.map(DateTime.decode),
)
}
@@ -87,9 +87,9 @@ let makeArrayFromJs = detailsOfTeams =>
detailsOfTeams->Belt.Array.keepMap(OptionUtils.map(makeFromJS))
let otherStudents = (studentId, t) =>
- t.students |> Js.Array.filter((student: student) => student.id != studentId)
+ t.students->Js.Array.filter((student: student) => student.id != studentId)
let coaches = (allTeamCoaches, t) =>
- allTeamCoaches |> Js.Array.filter(teamCoach =>
- t |> coachUserIds |> Array.mem(teamCoach |> UserProxy.userId)
+ allTeamCoaches->Js.Array.filter(teamCoach =>
+ t->coachUserIds->Array.mem(teamCoach->UserProxy.userId)
)
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamsList.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamsList.res
index 37428a3d75..cfb72da449 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamsList.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/CoursesStudents__TeamsList.res
@@ -7,102 +7,102 @@ let str = React.string
let levelInfo = (levelId, levels) =>
- {"Level" |> str}
+ {"Level"->str}
{levels
- |> ArrayUtils.unsafeFind(
+ ->ArrayUtils.unsafeFind(
(l: Level.t) => l.id == levelId,
"Unable to find level with id: " ++ (levelId ++ "in CoursesStudents__TeamsList"),
)
- |> Level.number
- |> string_of_int
- |> str}
+ ->Level.number
+ ->string_of_int
+ ->str}
let showStudent = (team, levels, teamCoaches) => {
let student = TeamInfo.students(team)[0]
TeamInfo.studentId) ++ "/report")}
- key={student |> TeamInfo.studentId}
- ariaLabel={"student-card-" ++ (student |> TeamInfo.studentId)}
+ href={"/students/" ++ ((student->TeamInfo.studentId) ++ "/report")}
+ key={student->TeamInfo.studentId}
+ ariaLabel={"student-card-" ++ (student->TeamInfo.studentId)}
className="flex md:flex-row justify-between bg-white mt-4 rounded-lg shadow cursor-pointer hover:border-primary-500 hover:text-primary-500 hover:shadow-md">
{CoursesStudents__TeamCoaches.avatar(
- student |> TeamInfo.studentAvatarUrl,
- student |> TeamInfo.studentName,
+ student->TeamInfo.studentAvatarUrl,
+ student->TeamInfo.studentName,
)}
- {student |> TeamInfo.studentName |> str}
+ {student->TeamInfo.studentName->str}
- {student |> TeamInfo.studentTitle |> str}
+ {student->TeamInfo.studentTitle->str}
TeamInfo.id)}
+ ariaLabel={"team-level-info-" ++ (team->TeamInfo.id)}
className="w-2/5 flex items-center justify-end md:justify-between p-3 md:p-4">
{"Personal Coaches" |> str}
}
+ title={ {"Personal Coaches"->str}
}
className="hidden md:inline-block"
coaches=teamCoaches
/>
- {levelInfo(team |> TeamInfo.levelId, levels)}
+ {levelInfo(team->TeamInfo.levelId, levels)}
}
let showTeam = (team, levels, teamCoaches) =>
TeamInfo.id}
- ariaLabel={"Info of team " ++ (team |> TeamInfo.id)}
+ key={team->TeamInfo.id}
+ ariaLabel={"Info of team " ++ (team->TeamInfo.id)}
className="flex shadow bg-white rounded-lg mt-4 overflow-hidden flex-col-reverse md:flex-row">
{team
- |> TeamInfo.students
- |> Array.map(student =>
+ ->TeamInfo.students
+ ->Array.map(student =>
TeamInfo.studentId) ++ "/report")}
- key={student |> TeamInfo.studentId}
- ariaLabel={"student-card-" ++ (student |> TeamInfo.studentId)}
+ href={"/students/" ++ ((student->TeamInfo.studentId) ++ "/report")}
+ key={student->TeamInfo.studentId}
+ ariaLabel={"student-card-" ++ (student->TeamInfo.studentId)}
className="flex items-center bg-white cursor-pointer hover:border-primary-500 hover:text-primary-500 hover:bg-gray-100">
{CoursesStudents__TeamCoaches.avatar(
- student |> TeamInfo.studentAvatarUrl,
- student |> TeamInfo.studentName,
+ student->TeamInfo.studentAvatarUrl,
+ student->TeamInfo.studentName,
)}
- {student |> TeamInfo.studentName |> str}
+ {student->TeamInfo.studentName->str}
- {student |> TeamInfo.studentTitle |> str}
+ {student->TeamInfo.studentTitle->str}
)
- |> React.array}
+ ->React.array}
-
{"Team" |> str}
-
{team |> TeamInfo.name |> str}
+
{"Team"->str}
+
{team->TeamInfo.name->str}
{"Team Coaches" |> str} }
+ title={
{"Team Coaches"->str}
}
className="hidden md:inline-block mt-3"
coaches=teamCoaches
/>
-
TeamInfo.id)} className="flex-shrink-0">
- {levelInfo(team |> TeamInfo.levelId, levels)}
+
TeamInfo.id)} className="flex-shrink-0">
+ {levelInfo(team->TeamInfo.levelId, levels)}
@@ -110,19 +110,19 @@ let showTeam = (team, levels, teamCoaches) =>
@react.component
let make = (~levels, ~teams, ~teamCoaches) =>
- {teams |> ArrayUtils.isEmpty
+ {teams->ArrayUtils.isEmpty
?
- {"No teams to show" |> str}
+ {"No teams to show"->str}
: teams
- |> Array.map(team => {
- let coaches = team |> TeamInfo.coaches(teamCoaches)
+ ->Array.map(team => {
+ let coaches = team->TeamInfo.coaches(teamCoaches)
- Array.length(team |> TeamInfo.students) == 1
+ Array.length(team->TeamInfo.students) == 1
? showStudent(team, levels, coaches)
: showTeam(team, levels, coaches)
})
- |> React.array}
+ ->React.array}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistItem.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistItem.res
index 2b261187f7..0c361b7812 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistItem.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistItem.res
@@ -33,7 +33,7 @@ let make = (~title, ~result, ~status) => {title: title, result: result, status:
let makeFile = (~name, ~url, ~id) => {name: name, url: url, id: id}
let makeFiles = data =>
- data |> Js.Array.map(a => makeFile(~url=a["url"], ~name=a["title"], ~id=a["id"]))
+ data->Js.Array.map(a => makeFile(~url=a["url"], ~name=a["title"], ~id=a["id"]))
let makeResult = (result, kind, files) =>
switch kind {
@@ -62,7 +62,7 @@ let makeStatus = data =>
}
let makeArrayFromJs = (files, checklist) =>
- checklist |> Js.Array.map(c =>
+ checklist->Js.Array.map(c =>
make(
~title=c["title"],
~result=makeResult(c["result"], c["kind"], makeFiles(files)),
@@ -73,23 +73,23 @@ let makeArrayFromJs = (files, checklist) =>
let decodeFile = json => {
open Json.Decode
{
- name: json |> field("name", string),
- url: json |> field("url", string),
- id: json |> field("id", string),
+ name: json->field("name", string),
+ url: json->field("url", string),
+ id: json->field("id", string),
}
}
let decode = (files, json) => {
open Json.Decode
{
- result: makeResult(json |> field("result", string), json |> field("kind", string), files),
- status: makeStatus(json |> field("status", string)),
- title: json |> field("title", string),
+ result: makeResult(json->field("result", string), json->field("kind", string), files),
+ status: makeStatus(json->field("status", string)),
+ title: json->field("title", string),
}
}
let updateStatus = (checklist, index, status) =>
- checklist |> Array.mapi((i, t) =>
+ checklist->Array.mapi((i, t) =>
i == index ? make(~title=t.title, ~result=t.result, ~status) : t
)
@@ -127,15 +127,15 @@ let encodeStatus = t =>
let encode = t => {
open Json.Encode
object_(list{
- ("title", t.title |> string),
- ("kind", encodeKind(t) |> string),
- ("status", encodeStatus(t) |> string),
- ("result", encodeResult(t) |> string),
+ ("title", t.title->string),
+ ("kind", encodeKind(t)->string),
+ ("status", encodeStatus(t)->string),
+ ("result", encodeResult(t)->string),
})
}
let encodeArray = checklist =>
- checklist |> {
+ checklist->{
open Json.Encode
array(encode)
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistItemShow.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistItemShow.res
index 60fd0249ce..3f80f8fd12 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistItemShow.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistItemShow.res
@@ -16,22 +16,22 @@ let kindIconClasses = result =>
let showFiles = files =>
let showlink = link =>
@@ -41,7 +41,7 @@ let showlink = link =>
className="max-w-fc mt-1 mr-3 flex border overflow-hidden rounded hover:shadow-md border-indigo-400 bg-white text-indigo-700 hover:border-blue-600 hover:text-indigo-800">
- {link |> str}
+ {link->str}
@@ -61,11 +61,11 @@ let showStatus = status =>
switch (status: ChecklistItem.status) {
| Passed =>
- {"Correct" |> str}
+ {"Correct"->str}
| Failed =>
- {"Incorrect" |> str}
+ {"Incorrect"->str}
| NoAnswer => React.null
}
@@ -91,8 +91,8 @@ let statusButtonIcon = bool =>
let statusButtonOnClick = (bool, callback, checklist, index, _event) =>
bool
- ? callback(checklist |> ChecklistItem.makeNoAnswer(index))
- : callback(checklist |> ChecklistItem.makeFailed(index))
+ ? callback(checklist->ChecklistItem.makeNoAnswer(index))
+ : callback(checklist->ChecklistItem.makeFailed(index))
let statusButton = (index, status, callback, checklist) =>
@@ -103,12 +103,12 @@ let statusButton = (index, status, callback, checklist) =>
-
{"Mark as incorrect" |> str}
+
{"Mark as incorrect"->str}
let computeShowResult = (pending, checklistItem) =>
- switch (pending, checklistItem |> ChecklistItem.status) {
+ switch (pending, checklistItem->ChecklistItem.status) {
| (true, NoAnswer | Passed | Failed) => true
| (false, Failed) => true
| (false, NoAnswer | Passed) => false
@@ -133,17 +133,17 @@ let make = (~index, ~checklistItem, ~updateChecklistCB, ~checklist, ~pending) =>
newShowResult == showResult ? () : setShowResult(_ => newShowResult)
None
}, [updateChecklistCB])
- let status = checklistItem |> ChecklistItem.status
+ let status = checklistItem->ChecklistItem.status
ChecklistItem.title}
+ ariaLabel={checklistItem->ChecklistItem.title}
onClick={_ => setShowResult(_ => true)}>
{statusIcon(updateChecklistCB, status)}
-
ChecklistItem.result)} />
- {checklistItem |> ChecklistItem.title |> str}
+ ChecklistItem.result)} />
+ {checklistItem->ChecklistItem.title->str}
{showResult ? showStatus(status) :
}
@@ -152,11 +152,11 @@ let make = (~index, ~checklistItem, ~updateChecklistCB, ~checklist, ~pending) =>
{showResult
?
- {switch checklistItem |> ChecklistItem.result {
- | ShortText(text) =>
{text |> str}
+ {switch checklistItem->ChecklistItem.result {
+ | ShortText(text) =>
{text->str}
| LongText(markdown) =>
| Link(link) => showlink(link)
- | MultiChoice(text) =>
{text |> str}
+ | MultiChoice(text) =>
{text->str}
| Files(files) => showFiles(files)
}}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistShow.res b/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistShow.res
index 405b2eadfc..4fb444b4b4 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistShow.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/courses/SubmissionChecklistShow.res
@@ -3,13 +3,13 @@ let str = React.string
@react.component
let make = (~checklist, ~updateChecklistCB, ~pending) =>
- {checklist |> ArrayUtils.isEmpty
- ?
{"Target was marked as complete." |> str}
+ {checklist->ArrayUtils.isEmpty
+ ?
{"Target was marked as complete."->str}
: checklist
- |> Array.mapi((index, checklistItem) =>
+ ->Array.mapi((index, checklistItem) =>
string_of_int} index checklistItem updateChecklistCB checklist pending
+ key={index->string_of_int} index checklistItem updateChecklistCB checklist pending
/>
)
- |> React.array}
+ ->React.array}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/home/HomeStyleguide__MarkdownSyntaxHighlightingPreview.res b/tests/syntax_tests/data/idempotency/pupilfirst/home/HomeStyleguide__MarkdownSyntaxHighlightingPreview.res
index 394d611505..189625ddc8 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/home/HomeStyleguide__MarkdownSyntaxHighlightingPreview.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/home/HomeStyleguide__MarkdownSyntaxHighlightingPreview.res
@@ -133,7 +133,7 @@ let renderedMarkdown = language => {
}
-
{title |> str}
+
{title->str}
}
@@ -157,14 +157,14 @@ let make = () => {
let (language, setLanguage) = React.useState(() => ReasonML)
- {"Select a language to preview:" |> str}
+ {"Select a language to preview:"->str}
{renderedMarkdown(language)}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__Course.res b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__Course.res
index 45559f8e6d..4f11ad2f8b 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__Course.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__Course.res
@@ -10,10 +10,10 @@ let name = t => t.name
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- name: json |> field("name", string),
+ id: json->field("id", string),
+ name: json->field("name", string),
}
}
let sort = courses =>
- courses |> List.sort((c1, c2) => Js.String.localeCompare(c2 |> name, c1 |> name) |> int_of_float)
+ courses->List.sort((c1, c2) => Js.String.localeCompare(c2->name, c1->name)->int_of_float)
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__CourseDropdown.res b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__CourseDropdown.res
index 6b6fc3944c..678e06881a 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__CourseDropdown.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__CourseDropdown.res
@@ -3,7 +3,7 @@ open SchoolAdminNavbar__Types
let str = React.string
let handleClick = (setShowDropdown, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
setShowDropdown(showDropdown => !showDropdown)
}
@@ -11,8 +11,8 @@ let handleClick = (setShowDropdown, event) => {
let make = (~courses, ~currentCourseId) => {
let (showDropdown, setShowDropdown) = React.useState(() => false)
let currentCourse =
- courses |> ListUtils.unsafeFind(
- course => course |> Course.id == currentCourseId,
+ courses->ListUtils.unsafeFind(
+ course => course->Course.id == currentCourseId,
"Could not find currentCourse with ID " ++ currentCourseId,
)
@@ -20,11 +20,11 @@ let make = (~courses, ~currentCourseId) => {
Course.name}
+ title={currentCourse->Course.name}
className="appearance-none flex items-center justify-between hover:bg-primary-100 hover:text-primary-500 focus:outline-none focus:bg-white focus:text-primary-500 font-semibold relative px-2 py-2 rounded w-full">
- {currentCourse |> Course.name |> str}
+ {currentCourse->Course.name->str}
@@ -32,18 +32,18 @@ let make = (~courses, ~currentCourseId) => {
?
: React.null}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__Root.res b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__Root.res
index 419c20e321..5c5b82b7ce 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__Root.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/SchoolAdminNavbar__Root.res
@@ -61,7 +61,7 @@ let bottomLink = (path, shrunk, iconClasses, text) => {
- {shrunk ? React.null : {text |> str} }
+ {shrunk ? React.null : {text->str} }
}
@@ -75,7 +75,7 @@ let topLink = (selectedOption, currentOption, path, shrunk, iconClasses, text) =
let title = shrunk ? Some(text) : None
- {shrunk ? React.null : {text |> str} }
+ {shrunk ? React.null : {text->str} }
}
@@ -83,7 +83,7 @@ let secondaryNavOption = (path, currentSelection, inspectedSelection, text) => {
let defaultClasses = "flex text-indigo-800 text-sm py-3 px-4 hover:bg-gray-400 focus:bg-gray-400 font-semibold rounded items-center my-1"
let classes = defaultClasses ++ (currentSelection == inspectedSelection ? " bg-gray-400" : "")
-
{text |> str}
+
{text->str}
}
let secondaryNav = (courses, userRole, selectedOption) =>
@@ -136,7 +136,7 @@ let secondaryNav = (courses, userRole, selectedOption) =>
Authors,
"Authors",
),
- ] |> React.array
+ ]->React.array
| CourseAuthor => React.null
}}
{secondaryNavOption(
@@ -200,7 +200,7 @@ let make = (~schoolName, ~schoolLogoPath, ~schoolIconPath, ~courses, ~isCourseAu
| _ =>
Rollbar.critical(
"Unknown path encountered by SA navbar: " ++
- (url.path |> Array.of_list |> Js.Array.joinWith("/")),
+ (url.path->Array.of_list->Js.Array.joinWith("/")),
)
raise(UnknownPathEncountered(url.path))
}
@@ -267,17 +267,17 @@ let make = (~schoolName, ~schoolLogoPath, ~schoolIconPath, ~courses, ~isCourseAu
? React.null
:
}
@@ -303,11 +303,11 @@ let make = (~schoolName, ~schoolLogoPath, ~schoolIconPath, ~courses, ~isCourseAu
rel="nofollow"
href="/users/sign_out">
- {shrunk ? React.null : {"Sign Out" |> str} }
+ {shrunk ? React.null : {"Sign Out"->str} }
,
- selectedOption |> secondaryNav(courses, userRole),
- ] |> React.array
+ selectedOption->secondaryNav(courses, userRole),
+ ]->React.array
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentCourse__Course.res b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentCourse__Course.res
index ea97fd1da3..8c31efa083 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentCourse__Course.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentCourse__Course.res
@@ -6,8 +6,8 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- name: json |> field("name", string),
+ id: json->field("id", string),
+ name: json->field("name", string),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentCourse__Header.res b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentCourse__Header.res
index 2137304708..f554c39345 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentCourse__Header.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentCourse__Header.res
@@ -6,16 +6,16 @@ module Course = StudentCourse__Course
let courseOptions = courses =>
courses
- |> List.map(course => {
- let courseId = course |> Course.id
+ ->List.map(course => {
+ let courseId = course->Course.id
- {course |> Course.name |> str}
+ {course->Course.name->str}
})
- |> Array.of_list
+ ->Array.of_list
let courseDropdown = (currentCourse, otherCourses) =>
@@ -24,7 +24,7 @@ let courseDropdown = (currentCourse, otherCourses) =>
- {currentCourse |> Course.name |> str}
+ {currentCourse->Course.name->str}
| otherCourses =>
@@ -32,7 +32,7 @@ let courseDropdown = (currentCourse, otherCourses) =>
- {currentCourse |> Course.name |> str}
+ {currentCourse->Course.name->str}
@@ -50,18 +50,18 @@ let courseDropdown = (currentCourse, otherCourses) =>
let courseNameContainerClasses = additionalLinks =>
"student-course__name-container w-full absolute bottom-0 " ++ (
- additionalLinks |> ListUtils.isEmpty
+ additionalLinks->ListUtils.isEmpty
? "pt-2 pb-3 md:pt-4 md:pb-6"
: "pt-2 pb-3 md:pt-4 md:pb-12"
)
let renderCourseSelector = (currentCourseId, courses, coverImage, additionalLinks) => {
let currentCourse =
- courses |> ListUtils.unsafeFind(
- c => c |> Course.id == currentCourseId,
+ courses->ListUtils.unsafeFind(
+ c => c->Course.id == currentCourseId,
"Could not find current course with ID " ++ (currentCourseId ++ " in StudentCourse__Header"),
)
- let otherCourses = courses |> List.filter(c => c |> Course.id != currentCourseId)
+ let otherCourses = courses->List.filter(c => c->Course.id != currentCourseId)
{switch coverImage {
@@ -100,8 +100,8 @@ let make = (~currentCourseId, ~courses, ~additionalLinks, ~coverImage) => {
{additionalLinks
- |> List.append(list{"curriculum"})
- |> List.map(l => {
+ ->List.append(list{"curriculum"})
+ ->List.map(l => {
let (title, suffix) = switch l {
| "curriculum" => ("Curriculum", "curriculum")
| "calendar" => ("Calendar", "calendar")
@@ -115,11 +115,11 @@ let make = (~currentCourseId, ~courses, ~additionalLinks, ~coverImage) => {
key=title
href={"/courses/" ++ (currentCourseId ++ ("/" ++ suffix))}
className={tabClasses(url, suffix)}>
- {title |> str}
+ {title->str}
})
- |> Array.of_list
- |> React.array}
+ ->Array.of_list
+ ->React.array}
}}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav.res b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav.res
index f467bba131..f02eac893d 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav.res
@@ -10,8 +10,8 @@ let headerLink = (key, link) =>
className="md:ml-5 text-sm font-semibold text-center cursor-default flex w-1/2 sm:w-1/3 md:w-auto justify-center border-r border-b md:border-0">
NavLink.url}>
- {link |> NavLink.title |> str}
+ href={link->NavLink.url}>
+ {link->NavLink.title->str}
@@ -24,7 +24,7 @@ let signOutLink = () =>
href="/users/sign_out"
rel="nofollow"
className="border border-primary-500 rounded px-2 py-1 text-primary-500 text-xs md:text-sm md:leading-normal m-4 md:m-0 no-underline font-semibold text-black">
-
{"Sign Out" |> str}
+
{"Sign Out"->str}
@@ -37,11 +37,11 @@ let signInLink = () =>
- {"Sign In" |> str}
+ {"Sign In"->str}
-let isMobile = () => Webapi.Dom.window |> Webapi.Dom.Window.innerWidth < 768
+let isMobile = () => Webapi.Dom.window->Webapi.Dom.Window.innerWidth < 768
let headerLinks = (links, isLoggedIn) => {
let (visibleLinks, dropdownLinks) = switch (links, isMobile()) {
@@ -52,11 +52,11 @@ let headerLinks = (links, isLoggedIn) => {
switch visibleLinks {
| visibleLinks =>
- (visibleLinks |> List.mapi((index, l) => headerLink(index |> string_of_int, l)))
+ (visibleLinks->List.mapi((index, l) => headerLink(index->string_of_int, l)))
->List.append(list{
})
->List.append(list{isLoggedIn ? signOutLink() : signInLink()})
- |> Array.of_list
- |> ReasonReact.array
+ ->Array.of_list
+ ->ReasonReact.array
}
}
@@ -66,7 +66,7 @@ let make = (~schoolName, ~logoUrl, ~links, ~isLoggedIn) => {
React.useEffect(() => {
let resizeCB = _ => toggleMenuHidden(_ => isMobile())
- Webapi.Dom.Window.asEventTarget(Webapi.Dom.window) |> Webapi.Dom.EventTarget.addEventListener(
+ Webapi.Dom.Window.asEventTarget(Webapi.Dom.window)->Webapi.Dom.EventTarget.addEventListener(
"resize",
resizeCB,
)
@@ -84,7 +84,7 @@ let make = (~schoolName, ~logoUrl, ~links, ~isLoggedIn) => {
| None =>
- {schoolName |> str}
+ {schoolName->str}
}}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav__DropDown.res b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav__DropDown.res
index 4625ed0d5f..5e9fac5921 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav__DropDown.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav__DropDown.res
@@ -9,17 +9,17 @@ let additionalLinks = (linksVisible, links) =>
?
{links
- |> List.mapi((index, link) =>
-
string_of_int} className="">
+ ->List.mapi((index, link) =>
+
)
- |> Array.of_list
- |> ReasonReact.array}
+ ->Array.of_list
+ ->ReasonReact.array}
: ReasonReact.null
@@ -34,7 +34,7 @@ let make = (~links) => {
className="ml-6 font-semibold text-sm cursor-pointer relative text-black"
onClick={handleToggle(setLinksVisible)}
key="more-links">
-
{"More" |> str}
+
{"More"->str}
{additionalLinks(linksVisible, moreLinks)}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav__NavLink.res b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav__NavLink.res
index 021273da61..401b156b60 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav__NavLink.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/layouts/StudentTopNav__NavLink.res
@@ -10,7 +10,7 @@ let url = t => t.url
let decode = json => {
open Json.Decode
{
- title: json |> field("title", string),
- url: json |> field("url", string),
+ title: json->field("title", string),
+ url: json->field("url", string),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectDropdown.res b/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectDropdown.res
index f00df12635..4a38b8021b 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectDropdown.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectDropdown.res
@@ -8,10 +8,10 @@ module DomUtils = {
open Webapi.Dom
let focus = id =>
- (switch document |> Document.getElementById(id) {
+ (switch document->Document.getElementById(id) {
| Some(el) => el
| None => raise(RootElementMissing(id))
- } |> Element.asHtmlElement)->Belt.Option.map(HtmlElement.focus) |> ignore
+ }->Element.asHtmlElement)->Belt.Option.map(HtmlElement.focus)->ignore
}
module type Selectable = {
@@ -24,19 +24,19 @@ module type Selectable = {
module Make = (Selectable: Selectable) => {
let search = (searchString, selections) =>
- (selections |> Js.Array.filter(selection =>
+ (selections->Js.Array.filter(selection =>
selection
- |> Selectable.searchString
- |> String.lowercase_ascii
- |> Js.String.includes(searchString |> String.lowercase_ascii)
+ ->Selectable.searchString
+ ->String.lowercase_ascii
+ ->Js.String.includes(searchString->String.lowercase_ascii)
))
->Belt.SortArray.stableSortBy((x, y) =>
- String.compare(x |> Selectable.value, y |> Selectable.value)
+ String.compare(x->Selectable.value, y->Selectable.value)
)
let selectionTitle = selection => {
- let value = selection |> Selectable.value
- switch selection |> Selectable.label {
+ let value = selection->Selectable.value
+ switch selection->Selectable.label {
| Some(label) => "Pick " ++ (label ++ (": " ++ value))
| None => "Pick " ++ value
}
@@ -56,7 +56,7 @@ module Make = (Selectable: Selectable) => {
}
let applyFilter = (selection, onSelect, id, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
onSelect(selection)
DomUtils.focus(id)
@@ -66,27 +66,27 @@ module Make = (Selectable: Selectable) => {
// Remove all excess space characters from the user input.
let normalizedString =
searchInput
- |> Js.String.trim
- |> Js.String.replaceByRe(Js.Re.fromStringWithFlags("\\s+", ~flags="g"), " ")
+ ->Js.String.trim
+ ->Js.String.replaceByRe(Js.Re.fromStringWithFlags("\\s+", ~flags="g"), " ")
switch normalizedString {
| "" => []
| searchString =>
- let matchingSelections = unselected |> search(searchString)
+ let matchingSelections = unselected->search(searchString)
- matchingSelections |> Array.mapi((index, selection) =>
+ matchingSelections->Array.mapi((index, selection) =>
string_of_int}
+ key={index->string_of_int}
title={selectionTitle(selection)}
className="flex text-xs py-1 items-center w-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200"
onClick={applyFilter(selection, onSelect, id)}>
- {switch selection |> Selectable.label {
+ {switch selection->Selectable.label {
| Some(label) =>
- {label ++ labelSuffix |> str}
+ {label ++ labelSuffix->str}
| None => React.null
}}
- Selectable.color, true)}>
- {selection |> Selectable.value |> str}
+ Selectable.color, true)}>
+ {selection->Selectable.value->str}
)
@@ -94,21 +94,21 @@ module Make = (Selectable: Selectable) => {
}
let removeSelection = (onDeselect, selection, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
onDeselect(selection)
}
let showSelected = (onDeselect, labelSuffix, selected) =>
- selected |> Array.mapi((index, selection) => {
- let value = selection |> Selectable.value
-
string_of_int} className="inline-flex py-1 mr-2">
-
Selectable.color, false)}>
+ selected->Array.mapi((index, selection) => {
+ let value = selection->Selectable.value
+
string_of_int} className="inline-flex py-1 mr-2">
+
Selectable.color, false)}>
- {switch selection |> Selectable.label {
+ {switch selection->Selectable.label {
| Some(label) => label ++ (labelSuffix ++ value)
| None => value
- } |> str}
+ }->str}
{
| Some(id) => id
| None =>
"re-multiselect-" ++
- ((Js.Date.now() |> Js.Float.toString) ++
- ("-" ++ (Js.Math.random_int(100000, 999999) |> string_of_int)))
+ ((Js.Date.now()->Js.Float.toString) ++
+ ("-" ++ (Js.Math.random_int(100000, 999999)->string_of_int)))
}
)
@@ -148,7 +148,7 @@ module Make = (Selectable: Selectable) => {
- {if value |> String.trim != "" {
+ {if value->String.trim != "" {
{switch results {
- | [] =>
{emptyMessage |> str}
- | results => results |> React.array
+ | [] =>
{emptyMessage->str}
+ | results => results->React.array
}}
} else {
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectDropdown__Example.res b/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectDropdown__Example.res
index 053de958bd..6f4984f6c3 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectDropdown__Example.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectDropdown__Example.res
@@ -67,7 +67,7 @@ module DetailedExample = {
"Bangalore",
"Cochin",
"Chennai",
- ] |> Array.map(t => Selectable.makeCity(t))
+ ]->Array.map(t => Selectable.makeCity(t))
let stateSuggestions =
[
@@ -78,30 +78,30 @@ module DetailedExample = {
"Kerala",
"Karnataka",
"Tamil Nadu",
- ] |> Array.map(l => Selectable.makeState(l))
+ ]->Array.map(l => Selectable.makeState(l))
let countrySuggestions =
- ["India", "USA", "Canada", "China", "Japan", "Egypt", "Korea"] |> Array.map(l =>
+ ["India", "USA", "Canada", "China", "Japan", "Egypt", "Korea"]->Array.map(l =>
Selectable.makeCountry(l)
)
let searchSuggestion =
- searchInput |> Js.String.trim == "" ? [] : [Selectable.makeSearch(searchInput)]
+ searchInput->Js.String.trim == "" ? [] : [Selectable.makeSearch(searchInput)]
searchSuggestion
- |> Array.append(citySuggestions)
- |> Array.append(stateSuggestions)
- |> Array.append(countrySuggestions)
+ ->Array.append(citySuggestions)
+ ->Array.append(stateSuggestions)
+ ->Array.append(countrySuggestions)
}
let select = (setState, selectable) =>
setState(s => {
searchInput: "",
- selected: [selectable] |> Array.append(s.selected),
+ selected: [selectable]->Array.append(s.selected),
})
let deselect = (selected, setState, selectable) => {
- let newSelected = selected |> Js.Array.filter(s => s != selectable)
+ let newSelected = selected->Js.Array.filter(s => s != selectable)
setState(_ => {searchInput: "", selected: newSelected})
}
@@ -111,12 +111,12 @@ module DetailedExample = {
let make = () => {
let (state, setState) = React.useState(() => {searchInput: "", selected: []})
-
{"Detailed Example" |> str}
+
{"Detailed Example"->str}
name
}
- let searchString = t => t |> value
+ let searchString = t => t->value
let color = _t => "gray"
let makeCountry = (~name, ~countryCode) => Country(countryCode, name)
@@ -172,7 +172,7 @@ module MinimalExample = {
]
let deselect = (selected, setState, selectable) => {
- let newSelected = selected |> Js.Array.filter(s => s != selectable)
+ let newSelected = selected->Js.Array.filter(s => s != selectable)
setState(_ => {searchString: "", selected: newSelected})
}
@@ -180,10 +180,10 @@ module MinimalExample = {
let make = () => {
let (state, setState) = React.useState(() => {searchString: "", selected: []})
-
{"Minimal Example" |> str}
+
{"Minimal Example"->str}
setState(s => {
searchString: "",
- selected: [selectable] |> Array.append(s.selected),
+ selected: [selectable]->Array.append(s.selected),
})}
onDeselect={deselect(state.selected, setState)}
value=state.searchString
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectInline.res b/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectInline.res
index 38038b51ab..f3b3060d95 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectInline.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectInline.res
@@ -10,24 +10,24 @@ module type Selectable = {
module Make = (Selectable: Selectable) => {
let search = (searchString, selections) =>
- (selections |> Js.Array.filter(selection =>
+ (selections->Js.Array.filter(selection =>
selection
- |> Selectable.searchString
- |> String.lowercase_ascii
- |> Js.String.includes(searchString |> String.lowercase_ascii)
+ ->Selectable.searchString
+ ->String.lowercase_ascii
+ ->Js.String.includes(searchString->String.lowercase_ascii)
))
->Belt.SortArray.stableSortBy((x, y) =>
- String.compare(x |> Selectable.value, y |> Selectable.value)
+ String.compare(x->Selectable.value, y->Selectable.value)
)
let searchUnselected = (searchInput, unselectedData) => {
let normalizedString =
searchInput
- |> Js.String.trim
- |> Js.String.replaceByRe(Js.Re.fromStringWithFlags("\\s+", ~flags="g"), " ")
+ ->Js.String.trim
+ ->Js.String.replaceByRe(Js.Re.fromStringWithFlags("\\s+", ~flags="g"), " ")
switch normalizedString {
| "" => unselectedData
- | searchString => unselectedData |> search(searchString)
+ | searchString => unselectedData->search(searchString)
}
}
@@ -36,7 +36,7 @@ module Make = (Selectable: Selectable) => {
let selectedItemClasses = colorForSelected =>
"bg-" ++ (colorForSelected ++ ("-200 " ++ borderColor(colorForSelected)))
- let searchVisible = (unselected, value) => value != "" || unselected |> Array.length > 3
+ let searchVisible = (unselected, value) => value != "" || unselected->Array.length > 3
@react.component
let make = (
@@ -57,8 +57,8 @@ module Make = (Selectable: Selectable) => {
| Some(id) => id
| None =>
"re-multiselect-" ++
- ((Js.Date.now() |> Js.Float.toString) ++
- ("-" ++ (Js.Math.random_int(100000, 999999) |> string_of_int)))
+ ((Js.Date.now()->Js.Float.toString) ++
+ ("-" ++ (Js.Math.random_int(100000, 999999)->string_of_int)))
}
)
@@ -67,16 +67,16 @@ module Make = (Selectable: Selectable) => {
- {selected |> Array.length > 0
+ {selected->Array.length > 0
? selected
- |> Array.mapi((index, selected) =>
+ ->Array.mapi((index, selected) =>
string_of_int}
+ key={index->string_of_int}
className="inline-flex font-semibold text-xs rounded mb-2 mr-2">
- {selected |> Selectable.value |> str}
+ {selected->Selectable.value->str}
{
)
- |> React.array
+ ->React.array
:
-
{emptySelectionMessage |> str}
+ {emptySelectionMessage->str}
}
{(
- unselected |> Array.length > 0
+ unselected->Array.length > 0
? "Add more from the list below:"
: allItemsSelectedMessage
- ) |> str}
+ )->str}
- {unselected |> Array.length > 0
+ {unselected->Array.length > 0
?
{
: React.null}
{searchResults
- |> Array.mapi((index, item) =>
+ ->Array.mapi((index, item) =>
string_of_int}
+ key={index->string_of_int}
onClick={_event => {
ReactEvent.Mouse.preventDefault(_event)
onSelect(item)
}}
- title={"Select " ++ (item |> Selectable.value)}
+ title={"Select " ++ (item->Selectable.value)}
className="flex multiselect-inline__list-item items-center px-3 py-2 font-semibold hover:bg-primary-100 hover:text-primary-500 cursor-pointer">
{
- {item |> Selectable.value |> str}
+ {item->Selectable.value->str}
)
- |> React.array}
+ ->React.array}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectInline__Example.res b/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectInline__Example.res
index 88cd874e87..124e831556 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectInline__Example.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packages/MultiselectInline__Example.res
@@ -34,20 +34,20 @@ module Example = {
"Formula 1",
"Squash",
"Boxing",
- ] |> Array.map(sportName => Selectable.makeSport(sportName))
- searchCollection |> Js.Array.filter(sport => !(selected |> Array.mem(sport)))
+ ]->Array.map(sportName => Selectable.makeSport(sportName))
+ searchCollection->Js.Array.filter(sport => !(selected->Array.mem(sport)))
}
let setSportSearch = (setState, value) => setState(state => {...state, searchInput: value})
let select = (setState, state, sport) => {
- let selected = state.selected |> Js.Array.concat([sport])
+ let selected = state.selected->Js.Array.concat([sport])
setState(_state => {searchInput: "", selected: selected})
}
let deSelect = (setState, state, sport) => {
let selected =
- state.selected |> Js.Array.filter(selected =>
+ state.selected->Js.Array.filter(selected =>
Selectable.value(sport) != Selectable.value(selected)
)
setState(_state => {searchInput: "", selected: selected})
@@ -57,11 +57,11 @@ module Example = {
let make = () => {
let (state, setState) = React.useState(() => {searchInput: "", selected: []})
-
{"Example" |> str}
+
{"Example"->str}
{
- let cp = t |> Array.copy
- cp |> Array.sort(f)
+ let cp = t->Array.copy
+ cp->Array.sort(f)
cp
}
@@ -92,15 +92,15 @@ module Example = {
let search = searchString => {
let normalizedString =
searchString
- |> Js.String.trim
- |> Js.String.replaceByRe(Js.Re.fromStringWithFlags("\\s+", ~flags="g"), " ")
+ ->Js.String.trim
+ ->Js.String.replaceByRe(Js.Re.fromStringWithFlags("\\s+", ~flags="g"), " ")
switch normalizedString {
| "" => icons
| searchString =>
icons
- |> Js.Array.filter(icon => icon |> String.lowercase_ascii |> Js.String.includes(searchString))
- |> copyAndSort(String.compare)
+ ->Js.Array.filter(icon => icon->String.lowercase_ascii->Js.String.includes(searchString))
+ ->copyAndSort(String.compare)
}
}
@@ -113,7 +113,7 @@ module Example = {
let make = () => {
let (searchString, setSearchString) = React.useState(() => "")
-
{"pf-icon" |> str}
+
{"pf-icon"->str}
{switch search(searchString) {
- | [] =>
{"Icon not found" |> str}
+ | [] =>
{"Icon not found"->str}
| resultIcons =>
resultIcons
- |> Array.map(icon => {
+ ->Array.map(icon => {
let iconClasses = "if i-" ++ icon
-
{icon |> str}
+
{icon->str}
- {"") |> str}
+ {"")->str}
})
- |> React.array
+ ->React.array
}}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/ConvertMarkdownPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/ConvertMarkdownPack.res
index ca192b3b9c..545ed2213e 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/ConvertMarkdownPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/ConvertMarkdownPack.res
@@ -11,18 +11,18 @@ type props = {
let decodeProps = json => {
open Json.Decode
{
- markdown: json |> field("markdown", string),
- profile: json |> field("profile", string),
+ markdown: json->field("markdown", string),
+ profile: json->field("profile", string),
}
}
let parseElement = (element, attribute) =>
- switch element |> Element.getAttribute(attribute) {
+ switch element->Element.getAttribute(attribute) {
| Some(props) => props
| None => raise(RootAttributeMissing(attribute))
}
- |> Json.parseOrRaise
- |> decodeProps
+ ->Json.parseOrRaise
+ ->decodeProps
let profileType = profile =>
switch profile {
@@ -35,11 +35,11 @@ let profileType = profile =>
let parseMarkdown = (~attributeName="convert-markdown", ~attribute="data-json-props", ()) =>
document
- |> Document.getElementsByClassName(attributeName)
- |> HtmlCollection.toArray
- |> Array.map(element => {
+ ->Document.getElementsByClassName(attributeName)
+ ->HtmlCollection.toArray
+ ->Array.map(element => {
let props = parseElement(element, attribute)
- element |> ReactDOMRe.render(
+ element->ReactDOMRe.render(
{
open Json.Decode
{
- courseName: json |> field("courseName", string),
- courseId: json |> field("courseId", string),
- thumbnailUrl: json |> field("thumbnailUrl", optional(string)),
- email: json |> field("email", optional(string)),
- name: json |> field("name", optional(string)),
- privacyPolicy: json |> field("privacyPolicy", bool),
- termsOfUse: json |> field("termsOfUse", bool),
+ courseName: json->field("courseName", string),
+ courseId: json->field("courseId", string),
+ thumbnailUrl: json->field("thumbnailUrl", optional(string)),
+ email: json->field("email", optional(string)),
+ name: json->field("name", optional(string)),
+ privacyPolicy: json->field("privacyPolicy", bool),
+ termsOfUse: json->field("termsOfUse", bool),
}
}
-let props = DomUtils.parseJsonTag() |> decodeProps
+let props = DomUtils.parseJsonTag()->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
(
- json |> field("course", Course.decode),
- json |> field("levels", list(Level.decode)),
- json |> field("targetGroups", list(TargetGroup.decode)),
- json |> field("targets", list(Target.decode)),
- json |> field("submissions", list(LatestSubmission.decode)),
- json |> field("team", Team.decode),
- json |> field("coaches", list(Coach.decode)),
- json |> field("users", list(User.decode)),
- json |> field("evaluationCriteria", list(EvaluationCriterion.decode)),
- json |> field("preview", bool),
- json |> field("accessLockedLevels", bool),
+ json->field("course", Course.decode),
+ json->field("levels", list(Level.decode)),
+ json->field("targetGroups", list(TargetGroup.decode)),
+ json->field("targets", list(Target.decode)),
+ json->field("submissions", list(LatestSubmission.decode)),
+ json->field("team", Team.decode),
+ json->field("coaches", list(Coach.decode)),
+ json->field("users", list(User.decode)),
+ json->field("evaluationCriteria", list(EvaluationCriterion.decode)),
+ json->field("preview", bool),
+ json->field("accessLockedLevels", bool),
)
}
@@ -30,7 +30,7 @@ let (
preview,
accessLockedLevels,
) =
- DomUtils.parseJsonTag() |> decodeProps
+ DomUtils.parseJsonTag()->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
(
- json |> field("levels", array(Level.decode)),
- json |> field("courseId", string),
- json |> field("teamCoaches", array(Coach.decode)),
- json |> field("currentCoach", Coach.decode),
+ json->field("levels", array(Level.decode)),
+ json->field("courseId", string),
+ json->field("teamCoaches", array(Coach.decode)),
+ json->field("currentCoach", Coach.decode),
)
}
-let (levels, courseId, teamCoaches, currentCoach) = DomUtils.parseJsonAttribute() |> decodeProps
+let (levels, courseId, teamCoaches, currentCoach) = DomUtils.parseJsonAttribute()->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/CoursesStudentsPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/CoursesStudentsPack.res
index f443b6b602..275fab9b09 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/CoursesStudentsPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/CoursesStudentsPack.res
@@ -3,16 +3,16 @@ open CoursesStudents__Types
let decodeProps = json => {
open Json.Decode
(
- json |> field("levels", array(Level.decode)),
- json |> field("course", Course.decode),
- json |> field("userId", string),
- json |> field("teamCoaches", array(Coach.decode)),
- json |> field("currentCoach", Coach.decode),
+ json->field("levels", array(Level.decode)),
+ json->field("course", Course.decode),
+ json->field("userId", string),
+ json->field("teamCoaches", array(Coach.decode)),
+ json->field("currentCoach", Coach.decode),
)
}
let (levels, course, userId, teamCoaches, currentCoach) =
- DomUtils.parseJsonTag(~id="school-course-students__props", ()) |> decodeProps
+ DomUtils.parseJsonTag(~id="school-course-students__props", ())->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/HomeStyleguidePack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/HomeStyleguidePack.res
index 117bbe59da..8ad26628ce 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/HomeStyleguidePack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/HomeStyleguidePack.res
@@ -3,12 +3,12 @@ ReactDOMRe.renderToElementWithId(
"styleguide__markdown-syntax-highlighting-root",
)
-let stringRepeat = (n, s) => s |> Array.make(n) |> Array.to_list |> String.concat("")
+let stringRepeat = (n, s) => s->Array.make(n)->Array.to_list->String.concat("")
ReactDOMRe.renderToElementWithId(
- {"This is the element being disabled. " |> stringRepeat(10) |> React.string}
+ {"This is the element being disabled. "->stringRepeat(10)->React.string}
,
"styleguide__disabling-cover-root",
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/QuestionsEditorPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/QuestionsEditorPack.res
index 9f5e1cd7a0..b88472fafb 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/QuestionsEditorPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/QuestionsEditorPack.res
@@ -8,8 +8,8 @@ type props = {
let decodeProps = json => {
open Json.Decode
{
- communityId: json |> field("communityId", string),
- target: json |> field("target", nullable(LinkedTarget.decode)) |> Js.Null.toOption,
+ communityId: json->field("communityId", string),
+ target: json->field("target", nullable(LinkedTarget.decode))->Js.Null.toOption,
}
}
@@ -18,7 +18,7 @@ let props =
~id="questions-editor",
~attribute="data-json-props",
(),
- ) |> decodeProps
+ )->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/QuestionsShowPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/QuestionsShowPack.res
index 519063b285..24c32c53b6 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/QuestionsShowPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/QuestionsShowPack.res
@@ -16,20 +16,20 @@ type props = {
let decodeProps = json => {
open Json.Decode
{
- question: json |> field("questions", Question.decode),
- answers: json |> field("answers", list(Answer.decode)),
- comments: json |> field("comments", list(Comment.decode)),
- users: json |> field("users", list(User.decode)),
- likes: json |> field("likes", list(Like.decode)),
- currentUserId: json |> field("currentUserId", string),
- communityPath: json |> field("communityPath", string),
- isCoach: json |> field("isCoach", bool),
- communityId: json |> field("communityId", string),
- target: json |> field("target", nullable(Target.decode)) |> Js.Null.toOption,
+ question: json->field("questions", Question.decode),
+ answers: json->field("answers", list(Answer.decode)),
+ comments: json->field("comments", list(Comment.decode)),
+ users: json->field("users", list(User.decode)),
+ likes: json->field("likes", list(Like.decode)),
+ currentUserId: json->field("currentUserId", string),
+ communityPath: json->field("communityPath", string),
+ isCoach: json->field("isCoach", bool),
+ communityId: json->field("communityId", string),
+ target: json->field("target", nullable(Target.decode))->Js.Null.toOption,
}
}
-let props = DomUtils.parseJsonAttribute() |> decodeProps
+let props = DomUtils.parseJsonAttribute()->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
{
- currentSchoolAdminId: json |> field("currentSchoolAdminId", string),
- admins: json |> field("admins", array(SchoolAdmin.decode)),
+ currentSchoolAdminId: json->field("currentSchoolAdminId", string),
+ admins: json->field("admins", array(SchoolAdmin.decode)),
}
}
-let props = DomUtils.parseJsonTag(~id="school-admins-data", ()) |> decodeProps
+let props = DomUtils.parseJsonTag(~id="school-admins-data", ())->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolCommunitiesPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolCommunitiesPack.res
index c9395df244..749b1d175d 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolCommunitiesPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolCommunitiesPack.res
@@ -7,9 +7,9 @@ type props = {
let decodeProps = json => {
open Json.Decode
{
- communities: json |> field("communities", list(SchoolCommunities__Community.decode)),
- courses: json |> field("courses", list(SchoolCommunities__Course.decode)),
- connections: json |> field("connections", list(SchoolCommunities__Connection.decode)),
+ communities: json->field("communities", list(SchoolCommunities__Community.decode)),
+ courses: json->field("courses", list(SchoolCommunities__Course.decode)),
+ connections: json->field("connections", list(SchoolCommunities__Connection.decode)),
}
}
@@ -18,7 +18,7 @@ let props =
~id="school-communities",
~attribute="data-json-props",
(),
- ) |> decodeProps
+ )->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
(
- json |> field("schoolName", string),
- json |> field("schoolLogoPath", string),
- json |> field("schoolIconPath", string),
- json |> field("courses", list(SchoolAdminNavbar__Course.decode)),
- json |> field("isCourseAuthor", bool),
+ json->field("schoolName", string),
+ json->field("schoolLogoPath", string),
+ json->field("schoolIconPath", string),
+ json->field("courses", list(SchoolAdminNavbar__Course.decode)),
+ json->field("isCourseAuthor", bool),
)
}
let (schoolName, schoolLogoPath, schoolIconPath, courses, isCourseAuthor) =
- DomUtils.parseJsonAttribute(~id="school-admin-navbar__root", ()) |> decodeProps
+ DomUtils.parseJsonAttribute(~id="school-admin-navbar__root", ())->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoachesCourseIndexPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoachesCourseIndexPack.res
index 9f6be347c9..bf225c084d 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoachesCourseIndexPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoachesCourseIndexPack.res
@@ -10,14 +10,14 @@ type props = {
let decodeProps = json => {
open Json.Decode
{
- courseCoaches: json |> field("courseCoaches", array(CourseCoach.decode)),
- schoolCoaches: json |> field("schoolCoaches", array(SchoolCoach.decode)),
- courseId: json |> field("courseId", string),
- authenticityToken: json |> field("authenticityToken", string),
+ courseCoaches: json->field("courseCoaches", array(CourseCoach.decode)),
+ schoolCoaches: json->field("schoolCoaches", array(SchoolCoach.decode)),
+ courseId: json->field("courseId", string),
+ authenticityToken: json->field("authenticityToken", string),
}
}
-let props = DomUtils.parseJsonTag(~id="course-coaches__props", ()) |> decodeProps
+let props = DomUtils.parseJsonTag(~id="course-coaches__props", ())->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
{
- coaches: json |> field("coaches", list(Coach.decode)),
- authenticityToken: json |> field("authenticityToken", string),
+ coaches: json->field("coaches", list(Coach.decode)),
+ authenticityToken: json->field("authenticityToken", string),
}
}
let props =
- DomUtils.parseJsonAttribute(~id="sa-coaches-panel", ~attribute="data-props", ()) |> decodeProps
+ DomUtils.parseJsonAttribute(~id="sa-coaches-panel", ~attribute="data-props", ())->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesAuthorsPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesAuthorsPack.res
index 0b92c01917..10af6c1f9f 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesAuthorsPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesAuthorsPack.res
@@ -2,11 +2,11 @@ open CourseAuthors__Types
let decodeProps = json => {
open Json.Decode
- (json |> field("courseId", string), json |> field("authors", array(Author.decode)))
+ (json->field("courseId", string), json->field("authors", array(Author.decode)))
}
let (courseId, authors) =
- DomUtils.parseJsonTag(~id="schools-courses-authors__props", ()) |> decodeProps
+ DomUtils.parseJsonTag(~id="schools-courses-authors__props", ())->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesCurriculumPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesCurriculumPack.res
index ecde00abc6..f216f7eba9 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesCurriculumPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesCurriculumPack.res
@@ -12,17 +12,17 @@ type props = {
let decodeProps = json => {
open Json.Decode
{
- course: json |> field("course", Course.decode),
- evaluationCriteria: json |> field("evaluationCriteria", list(EvaluationCriteria.decode)),
- levels: json |> field("levels", list(Level.decode)),
- targetGroups: json |> field("targetGroups", list(TargetGroup.decode)),
- targets: json |> field("targets", list(Target.decode)),
- authenticityToken: json |> field("authenticityToken", string),
+ course: json->field("course", Course.decode),
+ evaluationCriteria: json->field("evaluationCriteria", list(EvaluationCriteria.decode)),
+ levels: json->field("levels", list(Level.decode)),
+ targetGroups: json->field("targetGroups", list(TargetGroup.decode)),
+ targets: json->field("targets", list(Target.decode)),
+ authenticityToken: json->field("authenticityToken", string),
}
}
let props =
- DomUtils.parseJsonAttribute(~id="curriculum-editor", ~attribute="data-props", ()) |> decodeProps
+ DomUtils.parseJsonAttribute(~id="curriculum-editor", ~attribute="data-props", ())->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
{
- courseId: json |> field("courseId", string),
- evaluationCriteria: json |> field("evaluationCriteria", array(EvaluationCriterion.decode)),
+ courseId: json->field("courseId", string),
+ evaluationCriteria: json->field("evaluationCriteria", array(EvaluationCriterion.decode)),
}
}
let props =
- DomUtils.parseJsonTag(~id="schools-courses-evaluation-criteria__props", ()) |> decodeProps
+ DomUtils.parseJsonTag(~id="schools-courses-evaluation-criteria__props", ())->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesExportsPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesExportsPack.res
index 9a94d0d868..d365d1a909 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesExportsPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesExportsPack.res
@@ -3,14 +3,14 @@ open CourseExports__Types
let decodeProps = json => {
open Json.Decode
(
- json |> field("course", Course.decode),
- json |> field("exports", array(CourseExport.decode)),
- json |> field("tags", array(Tag.decode)),
+ json->field("course", Course.decode),
+ json->field("exports", array(CourseExport.decode)),
+ json->field("tags", array(Tag.decode)),
)
}
let (course, exports, tags) =
- DomUtils.parseJsonTag(~id="schools-courses-exports__props", ()) |> decodeProps
+ DomUtils.parseJsonTag(~id="schools-courses-exports__props", ())->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesInactiveStudentsPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesInactiveStudentsPack.res
index 3dc6f445d7..8f82913213 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesInactiveStudentsPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/SchoolsCoursesInactiveStudentsPack.res
@@ -12,17 +12,17 @@ type props = {
let decodeProps = json => {
open Json.Decode
{
- teams: json |> field("teams", list(Team.decode)),
- courseId: json |> field("courseId", string),
- students: json |> field("students", list(Student.decode)),
- authenticityToken: json |> field("authenticityToken", string),
- currentPage: json |> field("currentPage", int),
- isLastPage: json |> field("isLastPage", bool),
+ teams: json->field("teams", list(Team.decode)),
+ courseId: json->field("courseId", string),
+ students: json->field("students", list(Student.decode)),
+ authenticityToken: json->field("authenticityToken", string),
+ currentPage: json->field("currentPage", int),
+ isLastPage: json->field("isLastPage", bool),
}
}
let props =
- DomUtils.parseJsonAttribute(~id="sa-students-panel", ~attribute="data-props", ()) |> decodeProps
+ DomUtils.parseJsonAttribute(~id="sa-students-panel", ~attribute="data-props", ())->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
{
- courseId: json |> field("courseId", string),
- courseCoachIds: json |> field("courseCoachIds", array(string)),
- schoolCoaches: json |> field("schoolCoaches", array(Coach.decode)),
- levels: json |> field("levels", array(Level.decode)),
- studentTags: json |> field("studentTags", array(string)),
+ courseId: json->field("courseId", string),
+ courseCoachIds: json->field("courseCoachIds", array(string)),
+ schoolCoaches: json->field("schoolCoaches", array(Coach.decode)),
+ levels: json->field("levels", array(Level.decode)),
+ studentTags: json->field("studentTags", array(string)),
}
}
-let props = DomUtils.parseJsonTag(~id="sa-students-panel-data", ()) |> decodeProps
+let props = DomUtils.parseJsonTag(~id="sa-students-panel-data", ())->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
{
- authenticityToken: json |> field("authenticityToken", string),
- customizations: json |> field("customizations", SchoolCustomize__Customizations.decode),
- schoolName: json |> field("schoolName", string),
- schoolAbout: json |> field("schoolAbout", optional(string)),
+ authenticityToken: json->field("authenticityToken", string),
+ customizations: json->field("customizations", SchoolCustomize__Customizations.decode),
+ schoolName: json->field("schoolName", string),
+ schoolAbout: json->field("schoolAbout", optional(string)),
}
}
-let props = DomUtils.parseJsonTag(~id="school-customize-data", ()) |> decodeProps
+let props = DomUtils.parseJsonTag(~id="school-customize-data", ())->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
(
- json |> field("currentCourseId", string),
- json |> field("courses", list(StudentCourse__Course.decode)),
- json |> field("additionalLinks", list(string)),
- json |> field("coverImage", optional(string)),
+ json->field("currentCourseId", string),
+ json->field("courses", list(StudentCourse__Course.decode)),
+ json->field("additionalLinks", list(string)),
+ json->field("coverImage", optional(string)),
)
}
let (currentCourseId, courses, additionalLinks, coverImage) =
- DomUtils.parseJsonAttribute(~id="course-header-root", ()) |> decodeProps
+ DomUtils.parseJsonAttribute(~id="course-header-root", ())->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/StudentTopNavPack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/StudentTopNavPack.res
index b5cc6b4ffe..b572b1e531 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/StudentTopNavPack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/StudentTopNavPack.res
@@ -10,14 +10,14 @@ type props = {
let decodeProps = json => {
open Json.Decode
{
- schoolName: json |> field("schoolName", string),
- logoUrl: json |> field("logoUrl", nullable(string)) |> Js.Null.toOption,
- links: json |> field("links", list(NavLink.decode)),
- isLoggedIn: json |> field("isLoggedIn", bool),
+ schoolName: json->field("schoolName", string),
+ logoUrl: json->field("logoUrl", nullable(string))->Js.Null.toOption,
+ links: json->field("links", list(NavLink.decode)),
+ isLoggedIn: json->field("isLoggedIn", bool),
}
}
-let props = DomUtils.parseJsonTag(~id="student-top-nav-props", ()) |> decodeProps
+let props = DomUtils.parseJsonTag(~id="student-top-nav-props", ())->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
{
- schoolName: json |> field("schoolName", string),
- authenticityToken: json |> field("authenticityToken", string),
- fqdn: json |> field("fqdn", string),
- oauthHost: json |> field("oauthHost", string),
+ schoolName: json->field("schoolName", string),
+ authenticityToken: json->field("authenticityToken", string),
+ fqdn: json->field("fqdn", string),
+ oauthHost: json->field("oauthHost", string),
}
}
@@ -20,7 +20,7 @@ let props =
~id="user-session-new",
~attribute="data-json-props",
(),
- ) |> decodeProps
+ )->decodeProps
ReactDOMRe.renderToElementWithId(
{
open Json.Decode
{
- token: json |> field("token", string),
- authenticityToken: json |> field("authenticityToken", string),
+ token: json->field("token", string),
+ authenticityToken: json->field("authenticityToken", string),
}
}
@@ -16,7 +16,7 @@ let props =
~id="user-session-reset-password",
~attribute="data-json-props",
(),
- ) |> decodeProps
+ )->decodeProps
ReactDOMRe.renderToElementWithId(
,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/packs/UsersHomePack.res b/tests/syntax_tests/data/idempotency/pupilfirst/packs/UsersHomePack.res
index d7f566be0c..55d4beef66 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/packs/UsersHomePack.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/packs/UsersHomePack.res
@@ -11,17 +11,17 @@ type props = {
let decodeProps = json => {
open Json.Decode
{
- currentSchoolAdmin: json |> field("currentSchoolAdmin", bool),
- showUserEdit: json |> field("showUserEdit", bool),
- userName: json |> field("userName", string),
- userTitle: json |> field("userTitle", string),
- avatarUrl: json |> optional(field("avatarUrl", string)),
- courses: json |> field("courses", array(UsersHome__Course.decode)),
- communities: json |> field("communities", array(UsersHome__Community.decode)),
+ currentSchoolAdmin: json->field("currentSchoolAdmin", bool),
+ showUserEdit: json->field("showUserEdit", bool),
+ userName: json->field("userName", string),
+ userTitle: json->field("userTitle", string),
+ avatarUrl: json->optional(field("avatarUrl", string)),
+ courses: json->field("courses", array(UsersHome__Course.decode)),
+ communities: json->field("communities", array(UsersHome__Community.decode)),
}
}
-let props = DomUtils.parseJsonTag(~id="users-home-data", ()) |> decodeProps
+let props = DomUtils.parseJsonTag(~id="users-home-data", ())->decodeProps
ReactDOMRe.renderToElementWithId(
showAnswerCreate: bool,
}
- | AddLike(like) => {...state, likes: state.likes |> Like.addLike(like)}
- | RemoveLike(id) => {...state, likes: state.likes |> Like.removeLike(id)}
+ | AddLike(like) => {...state, likes: state.likes->Like.addLike(like)}
+ | RemoveLike(id) => {...state, likes: state.likes->Like.removeLike(id)}
| UpdateShowAnswerCreate(bool) => {...state, showAnswerCreate: bool}
| UpdateShowQuestionEdit(bool) => {...state, showQuestionEdit: bool}
| UpdateQuestion(question) => {...state, question: question, showQuestionEdit: false}
| RemoveAnswer(id) => {
...state,
- answers: state.answers |> Answer.delete(id),
+ answers: state.answers->Answer.delete(id),
}
| RemoveComment(id) => {
...state,
- comments: state.comments |> Comment.delete(id),
+ comments: state.comments->Comment.delete(id),
}
| UpdateAnswer(answer) => {
...state,
@@ -60,20 +60,20 @@ let showAnswersCreateComponent = (answers, showAnswerCreate, currentUserId) =>
if showAnswerCreate {
true
} else {
- answers |> Answer.answerFromUser(currentUserId) |> ListUtils.isEmpty
+ answers->Answer.answerFromUser(currentUserId)->ListUtils.isEmpty
}
-let likesForAnswer = (likes, answerId) => likes |> Like.likesForAnswer(answerId) |> List.length
+let likesForAnswer = (likes, answerId) => likes->Like.likesForAnswer(answerId)->List.length
let handleUpdateQuestion = (title, description, currentUserId, question, dispatch) => {
let newQuestion = Question.create(
- question |> Question.id,
+ question->Question.id,
title,
description,
- question |> Question.creatorId,
+ question->Question.creatorId,
Some(currentUserId),
- question |> Question.createdAt,
- question |> Question.updatedAt,
+ question->Question.createdAt,
+ question->Question.updatedAt,
)
dispatch(UpdateQuestion(newQuestion))
}
@@ -111,12 +111,12 @@ let make = (
handleUpdateQuestion(title, description, currentUserId, question, dispatch)
let archiveCB = (id, resourceType) =>
switch resourceType {
- | "Question" => communityPath |> Webapi.Dom.Window.setLocation(Webapi.Dom.window)
+ | "Question" => communityPath->Webapi.Dom.Window.setLocation(Webapi.Dom.window)
| "Answer" => dispatch(RemoveAnswer(id))
| "Comment" => dispatch(RemoveComment(id))
| _ => Notification.error("Something went wrong", "Please refresh the page and try again")
}
- let filteredAnswers = state.answers |> List.filter(answer => !(answer |> Answer.archived))
+ let filteredAnswers = state.answers->List.filter(answer => !(answer->Answer.archived))
@@ -127,10 +127,10 @@ let make = (
id="close-button"
className="btn btn-subtle cursor-default"
onClick={event => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
dispatch(UpdateShowQuestionEdit(false))
}}>
- {"Close" |> str}
+ {"Close"->str}
{switch target {
@@ -150,14 +150,14 @@ let make = (
className="flex py-4 px-4 md:px-5 w-full bg-white border border-primary-500 shadow-md rounded-lg justify-between items-center mb-2">
- {"Linked Target: " |> str}
+ {"Linked Target: "->str}
- {target |> Target.title |> str}
+ {target->Target.title->str}
- {switch target |> Target.id {
+ {switch target->Target.id {
| Some(id) =>
- {"View Target" |> str}
+ {"View Target"->str}
| None => React.null
}}
@@ -171,57 +171,57 @@ let make = (
- {state.question |> Question.title |> str}
+ {state.question->Question.title->str}
Question.description}
+ markdown={state.question->Question.description}
className="leading-normal text-sm"
profile=Markdown.QuestionAndAnswer
/>
- {switch state.question |> Question.editorId {
+ {switch state.question->Question.editorId {
| Some(editorId) =>
- {"Last edited by " |> str}
+ {"Last edited by "->str}
- {users |> User.findById(editorId) |> User.name |> str}
+ {users->User.findById(editorId)->User.name->str}
{" on " ++
(state.question
- |> Question.updatedAt
- |> DateTime.stingToFormatedTime(DateTime.DateWithYearAndTime)) |> str}
+ ->Question.updatedAt
+ ->DateTime.stingToFormatedTime(DateTime.DateWithYearAndTime))->str}
@@ -233,15 +233,15 @@ let make = (
{state.comments
- |> Comment.commentsForQuestion
- |> List.length
- |> string_of_int
- |> str}
+ ->Comment.commentsForQuestion
+ ->List.length
+ ->string_of_int
+ ->str}
User.findById(state.question |> Question.creatorId)}
- createdAt={state.question |> Question.createdAt}
+ user={users->User.findById(state.question->Question.creatorId)}
+ createdAt={state.question->Question.createdAt}
textForTimeStamp="Asked"
/>
@@ -249,10 +249,10 @@ let make = (
Comment.commentsForQuestion}
+ comments={state.comments->Comment.commentsForQuestion}
users
commentableType="Question"
- commentableId={state.question |> Question.id}
+ commentableId={state.question->Question.id}
addCommentCB
currentUserId
archiveCB
@@ -262,29 +262,29 @@ let make = (
{
- let numberOfAnswers = filteredAnswers |> List.length
- (numberOfAnswers |> string_of_int) ++ (
+ let numberOfAnswers = filteredAnswers->List.length
+ (numberOfAnswers->string_of_int) ++ (
numberOfAnswers == 1 ? " Answer" : " Answers"
- ) |> str
+ )->str
}
{filteredAnswers
- |> List.sort((answerA, answerB) =>
+ ->List.sort((answerA, answerB) =>
DateFns.differenceInSeconds(
- answerB |> Answer.createdAt |> DateFns.parseString,
- answerA |> Answer.createdAt |> DateFns.parseString,
- ) |> int_of_float
+ answerB->Answer.createdAt->DateFns.parseString,
+ answerA->Answer.createdAt->DateFns.parseString,
+ )->int_of_float
)
- |> List.stable_sort((answerA, answerB) =>
- likesForAnswer(likes, answerB |> Answer.id) -
- likesForAnswer(likes, answerA |> Answer.id)
+ ->List.stable_sort((answerA, answerB) =>
+ likesForAnswer(likes, answerB->Answer.id) -
+ likesForAnswer(likes, answerA->Answer.id)
)
- |> List.map(answer =>
+ ->List.map(answer =>
Answer.id}
+ key={answer->Answer.id}
answer
question=state.question
addCommentCB
@@ -299,8 +299,8 @@ let make = (
archiveCB
/>
)
- |> Array.of_list
- |> ReasonReact.array}
+ ->Array.of_list
+ ->ReasonReact.array}
{showAnswersCreateComponent(state.answers, state.showAnswerCreate, currentUserId)
?
@@ -310,7 +310,7 @@ let make = (
dispatch(UpdateShowAnswerCreate(true))}>
- {"Add another answer" |> str}
+ {"Add another answer"->str}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AddComment.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AddComment.res
index 4f3146a8e6..635306c959 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AddComment.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AddComment.res
@@ -60,14 +60,14 @@ let make = (~commentableType, ~commentableId, ~addCommentCB, ~currentUserId) =>
}
let handleCreateComment = event => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
if validComment {
setSaving(_ => true)
CreateCommentQuery.make(~value, ~commentableId, ~commentableType, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response =>
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response =>
switch response["createComment"] {
| #CommentId(commentId) =>
handleResponseCB(commentId)
@@ -76,8 +76,8 @@ let make = (~commentableType, ~commentableId, ~addCommentCB, ~currentUserId) =>
| #Errors(errors) => Js.Promise.reject(CreateCommentErrorHandler.Errors(errors))
}
)
- |> CreateCommentErrorHandler.catch(() => setSaving(_ => false))
- |> ignore
+ ->CreateCommentErrorHandler.catch(() => setSaving(_ => false))
+ ->ignore
} else {
()
}
@@ -97,7 +97,7 @@ let make = (~commentableType, ~commentableId, ~addCommentCB, ~currentUserId) =>
?
- {"Comment" |> str}
+ {"Comment"->str}
: ReasonReact.null}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Answer.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Answer.res
index d30d0c51e2..678df6d17d 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Answer.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Answer.res
@@ -11,13 +11,13 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- description: json |> field("description", string),
- creatorId: json |> field("creatorId", string),
- editorId: json |> field("editorId", nullable(string)) |> Js.Null.toOption,
- createdAt: json |> field("createdAt", string),
- archived: json |> field("archived", bool),
- updatedAt: json |> field("updatedAt", string),
+ id: json->field("id", string),
+ description: json->field("description", string),
+ creatorId: json->field("creatorId", string),
+ editorId: json->field("editorId", nullable(string))->Js.Null.toOption,
+ createdAt: json->field("createdAt", string),
+ archived: json->field("archived", bool),
+ updatedAt: json->field("updatedAt", string),
}
}
@@ -36,14 +36,14 @@ let updatedAt = t => t.updatedAt
let addAnswer = (answers, answer) => list{answer, ...answers}
let updateAnswer = (answers, newAnswer) =>
- answers |> List.map(answer => answer.id == newAnswer.id ? newAnswer : answer)
+ answers->List.map(answer => answer.id == newAnswer.id ? newAnswer : answer)
let answerFromUser = (userId, answers) =>
- answers |> List.filter(answer => answer.creatorId == userId)
+ answers->List.filter(answer => answer.creatorId == userId)
let archived = t => t.archived
-let delete = (id, answers) => answers |> List.filter(a => a.id != id)
+let delete = (id, answers) => answers->List.filter(a => a.id != id)
let create = (id, description, creatorId, editorId, createdAt, updatedAt, archived) => {
id: id,
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AnswerEditor.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AnswerEditor.res
index a692530ced..c035686c80 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AnswerEditor.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AnswerEditor.res
@@ -78,9 +78,9 @@ let handleAnswerUpdateResponseCB = (
let newAnswer = Answer.create(
id,
description,
- answer |> Answer.creatorId,
+ answer->Answer.creatorId,
Some(currentUserId),
- answer |> Answer.createdAt,
+ answer->Answer.createdAt,
dateTime,
false,
)
@@ -99,17 +99,17 @@ let handleAnswer = (
answer,
event,
) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
if description != "" {
setSaving(_ => true)
switch answer {
| Some(answer) =>
- let answerId = answer |> Answer.id
+ let answerId = answer->Answer.id
UpdateAnswerQuery.make(~description, ~id=answerId, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response =>
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response =>
switch response["updateAnswer"] {
| #Success(answerUpdated) =>
answerUpdated
@@ -128,12 +128,12 @@ let handleAnswer = (
| #Errors(errors) => Js.Promise.reject(UpdateAnswerErrorHandler.Errors(errors))
}
)
- |> UpdateAnswerErrorHandler.catch(() => setSaving(_ => false))
- |> ignore
+ ->UpdateAnswerErrorHandler.catch(() => setSaving(_ => false))
+ ->ignore
| None =>
- CreateAnswerQuery.make(~description, ~questionId=question |> Question.id, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response =>
+ CreateAnswerQuery.make(~description, ~questionId=question->Question.id, ())
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response =>
switch response["createAnswer"] {
| #AnswerId(answerId) =>
handleAnswerCreateCB(
@@ -149,8 +149,8 @@ let handleAnswer = (
| #Errors(errors) => Js.Promise.reject(CreateAnswerErrorHandler.Errors(errors))
}
)
- |> CreateAnswerErrorHandler.catch(() => setSaving(_ => false))
- |> ignore
+ ->CreateAnswerErrorHandler.catch(() => setSaving(_ => false))
+ ->ignore
}
} else {
Notification.error("Empty", "Answer cant be blank")
@@ -161,7 +161,7 @@ let handleAnswer = (
let make = (~question, ~currentUserId, ~handleAnswerCB, ~answer=?, ~handleCloseCB=?) => {
let (description, setDescription) = React.useState(() =>
switch answer {
- | Some(answer) => answer |> Answer.description
+ | Some(answer) => answer->Answer.description
| None => ""
}
)
@@ -174,7 +174,7 @@ let make = (~question, ~currentUserId, ~handleAnswerCB, ~answer=?, ~handleCloseC
handleCloseCB()} className="btn btn-default mr-2">
- {"Cancel" |> str}
+ {"Cancel"->str}
| None => React.null
}}
@@ -208,7 +208,7 @@ let make = (~question, ~currentUserId, ~handleAnswerCB, ~answer=?, ~handleCloseC
{switch answer {
| Some(_) => "Update Your Answer"
| None => "Post Your Answer"
- } |> str}
+ }->str}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AnswerShow.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AnswerShow.res
index 5c69ea2c2e..59d305fa19 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AnswerShow.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__AnswerShow.res
@@ -17,8 +17,8 @@ let make = (
~isCoach,
~archiveCB,
) => {
- let user = users |> User.findById(answer |> Answer.creatorId)
- let commentsForAnswer = comments |> Comment.commentsForAnswer(answer |> Answer.id)
+ let user = users->User.findById(answer->Answer.creatorId)
+ let commentsForAnswer = comments->Comment.commentsForAnswer(answer->Answer.id)
let (showAnswerEdit, toggleShowAnswerEdit) = React.useState(() => false)
let handleCloseCB = () => toggleShowAnswerEdit(_ => false)
@@ -28,66 +28,66 @@ let make = (
handleAnswerCB(answer, bool)
}
- Answer.id}>
+
Answer.id}>
{showAnswerEdit
?
- :
Answer.id)}>
+ :
Answer.id)}>
Answer.description}
+ markdown={answer->Answer.description}
className="leading-normal text-sm "
profile=Markdown.QuestionAndAnswer
/>
- {switch answer |> Answer.editorId {
+ {switch answer->Answer.editorId {
| Some(editorId) =>
- {"Last edited by " |> str}
+ {"Last edited by "->str}
- {users |> User.findById(editorId) |> User.name |> str}
+ {users->User.findById(editorId)->User.name->str}
{" on " ++
(answer
- |> Answer.updatedAt
- |> DateTime.stingToFormatedTime(DateTime.DateWithYearAndTime)) |> str}
+ ->Answer.updatedAt
+ ->DateTime.stingToFormatedTime(DateTime.DateWithYearAndTime))->str}
@@ -98,7 +98,7 @@ let make = (
Answer.id} currentUserId addLikeCB removeLikeCB
+ likes answerId={answer->Answer.id} currentUserId addLikeCB removeLikeCB
/>
- {commentsForAnswer |> List.length |> string_of_int |> str}
+ {commentsForAnswer->List.length->string_of_int->str}
Answer.createdAt} textForTimeStamp="Answered"
+ user createdAt={answer->Answer.createdAt} textForTimeStamp="Answered"
/>
@@ -122,7 +122,7 @@ let make = (
comments=commentsForAnswer
users
commentableType="Answer"
- commentableId={answer |> Answer.id}
+ commentableId={answer->Answer.id}
addCommentCB
currentUserId
archiveCB
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__ArchiveManager.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__ArchiveManager.res
index 78c8fac218..2a0df2d2f6 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__ArchiveManager.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__ArchiveManager.res
@@ -9,17 +9,17 @@ module ArchiveQuery = %graphql(`
`)
let archive = (id, resourceType, archiveCB, setSaving, event) =>
- Webapi.Dom.window |> Webapi.Dom.Window.confirm(
+ Webapi.Dom.window->Webapi.Dom.Window.confirm(
"Are you sure you want to delete this " ++
- ((resourceType |> Js.String.toLowerCase) ++
+ ((resourceType->Js.String.toLowerCase) ++
". You cannot undo this."),
)
? {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
setSaving(_ => true)
ArchiveQuery.make(~id, ~resourceType, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
response["archiveCommunityResource"]["success"]
? {
Notification.success("Success", resourceType ++ " archived successfully")
@@ -28,7 +28,7 @@ let archive = (id, resourceType, archiveCB, setSaving, event) =>
: Notification.error("Something went wrong", "Please refresh the page and try again")
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
: ()
@@ -40,6 +40,6 @@ let make = (~id, ~resourceType, ~archiveCB) => {
onClick={archive(id, resourceType, archiveCB, setSaving)}
className="flex items-center justify-center whitespace-no-wrap text-xs font-semibold py-1 px-3 flex-shrink-0 bg-transparent text-gray-700 hover:bg-red-100 hover:text-red-700 cursor-pointer">
{saving ?
:
}
- {resourceType == "Comment" ? React.null :
{"Delete" |> str} }
+ {resourceType == "Comment" ? React.null :
{"Delete"->str} }
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Comment.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Comment.res
index c488cbed36..57921cee06 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Comment.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Comment.res
@@ -10,12 +10,12 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- value: json |> field("value", string),
- creatorId: json |> field("creatorId", string),
- commentableId: json |> field("commentableId", string),
- commentableType: json |> field("commentableType", string),
- createdAt: json |> field("createdAt", string),
+ id: json->field("id", string),
+ value: json->field("value", string),
+ creatorId: json->field("creatorId", string),
+ commentableId: json->field("commentableId", string),
+ commentableType: json->field("commentableType", string),
+ createdAt: json->field("createdAt", string),
}
}
@@ -27,17 +27,17 @@ let id = t => t.id
let createdAt = t => t.createdAt
let commentsForQuestion = comments =>
- comments |> List.filter(comment => comment.commentableType == "Question")
+ comments->List.filter(comment => comment.commentableType == "Question")
let commentsForAnswer = (answerId, comments) =>
comments
- |> List.filter(comment => comment.commentableType == "Answer")
- |> List.filter(comment => comment.commentableId == answerId)
+ ->List.filter(comment => comment.commentableType == "Answer")
+ ->List.filter(comment => comment.commentableId == answerId)
let addComment = (comments, comment) =>
- comments |> List.rev |> List.append(list{comment}) |> List.rev
+ comments->List.rev->List.append(list{comment})->List.rev
-let delete = (id, comments) => comments |> List.filter(c => c.id != id)
+let delete = (id, comments) => comments->List.filter(c => c.id != id)
let create = (id, value, creatorId, commentableId, commentableType, createdAt) => {
id: id,
@@ -49,4 +49,4 @@ let create = (id, value, creatorId, commentableId, commentableType, createdAt) =
}
let sort = comments =>
- comments |> List.sort((c1, c2) => (c1.id |> int_of_string) - (c2.id |> int_of_string))
+ comments->List.sort((c1, c2) => (c1.id->int_of_string) - (c2.id->int_of_string))
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__CommentShow.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__CommentShow.res
index 3de5fa0b2c..0c7b84a006 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__CommentShow.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__CommentShow.res
@@ -13,9 +13,9 @@ let make = (
~archiveCB,
~isCoach,
) => {
- let (showAll, setShowAll) = React.useState(() => comments |> List.length <= 3)
+ let (showAll, setShowAll) = React.useState(() => comments->List.length <= 3)
- let (commentsToShow, allCommentsShown) = switch (showAll, comments |> Comment.sort) {
+ let (commentsToShow, allCommentsShown) = switch (showAll, comments->Comment.sort) {
| (false, list{e1, e2, e3, _e4, ..._rest}) => (list{e1, e2, e3}, false)
| (_, comments) => (comments, true)
}
@@ -23,39 +23,39 @@ let make = (
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Like.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Like.res
index 88cc1af605..a366ffaaf1 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Like.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Like.res
@@ -7,24 +7,24 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- userId: json |> field("userId", string),
- answerId: json |> field("answerId", string),
+ id: json->field("id", string),
+ userId: json->field("userId", string),
+ answerId: json->field("answerId", string),
}
}
let id = t => t.id
-let likesForAnswer = (answerId, likes) => likes |> List.filter(like => like.answerId == answerId)
+let likesForAnswer = (answerId, likes) => likes->List.filter(like => like.answerId == answerId)
let likeByCurrentUser = (answerId, currentUserId, likes) =>
- likesForAnswer(answerId, likes) |> List.filter(like => like.userId == currentUserId)
+ likesForAnswer(answerId, likes)->List.filter(like => like.userId == currentUserId)
let currentUserLiked = (answerId, currentUserId, likes) =>
- likeByCurrentUser(answerId, currentUserId, likes) |> ListUtils.isNotEmpty
+ likeByCurrentUser(answerId, currentUserId, likes)->ListUtils.isNotEmpty
-let addLike = (like, likes) => likes |> List.append(list{like})
+let addLike = (like, likes) => likes->List.append(list{like})
-let removeLike = (id, likes) => likes |> List.filter(like => like.id != id)
+let removeLike = (id, likes) => likes->List.filter(like => like.id != id)
let create = (id, userId, answerId) => {id: id, userId: userId, answerId: answerId}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__LikeManager.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__LikeManager.res
index 1a46d196e3..d279060508 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__LikeManager.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__LikeManager.res
@@ -58,25 +58,25 @@ let handleAnswerLike = (
addLikeCB,
event,
) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
saving
? ()
: {
setSaving(_ => true)
if liked {
- let id = Like.likeByCurrentUser(answerId, currentUserId, likes) |> List.hd |> Like.id
+ let id = Like.likeByCurrentUser(answerId, currentUserId, likes)->List.hd->Like.id
DestroyAnswerLikeQuery.make(~id, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(_response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(_response => {
removeLikeCB(id)
setSaving(_ => false)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
} else {
CreateAnswerLikeQuery.make(~answerId, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response =>
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response =>
switch response["createAnswerLike"] {
| #AnswerLikeId(answerLikeId) =>
handleCreateResponse(answerLikeId, currentUserId, answerId, setSaving, addLikeCB)
@@ -84,15 +84,15 @@ let handleAnswerLike = (
| #Errors(errors) => Js.Promise.reject(CreateAnswerLikeErrorHandler.Errors(errors))
}
)
- |> CreateAnswerLikeErrorHandler.catch(() => setSaving(_ => false))
- |> ignore
+ ->CreateAnswerLikeErrorHandler.catch(() => setSaving(_ => false))
+ ->ignore
}
}
}
@react.component
let make = (~likes, ~answerId, ~currentUserId, ~addLikeCB, ~removeLikeCB) => {
- let liked = likes |> Like.currentUserLiked(answerId, currentUserId)
+ let liked = likes->Like.currentUserLiked(answerId, currentUserId)
let (saving, setSaving) = React.useState(() => false)
@@ -116,7 +116,7 @@ let make = (~likes, ~answerId, ~currentUserId, ~addLikeCB, ~removeLikeCB) => {
- {likes |> Like.likesForAnswer(answerId) |> List.length |> string_of_int |> str}
+ {likes->Like.likesForAnswer(answerId)->List.length->string_of_int->str}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__LinkedTarget.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__LinkedTarget.res
index bb6da8f369..db18752d1f 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__LinkedTarget.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__LinkedTarget.res
@@ -6,8 +6,8 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- title: json |> field("title", string),
+ id: json->field("id", string),
+ title: json->field("title", string),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Question.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Question.res
index 325ee01851..e3007213b7 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Question.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Question.res
@@ -11,13 +11,13 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- title: json |> field("title", string),
- description: json |> field("description", string),
- creatorId: json |> field("creatorId", string),
- editorId: json |> field("editorId", nullable(string)) |> Js.Null.toOption,
- createdAt: json |> field("createdAt", string),
- updatedAt: json |> field("updatedAt", string),
+ id: json->field("id", string),
+ title: json->field("title", string),
+ description: json->field("description", string),
+ creatorId: json->field("creatorId", string),
+ editorId: json->field("editorId", nullable(string))->Js.Null.toOption,
+ createdAt: json->field("createdAt", string),
+ updatedAt: json->field("updatedAt", string),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__QuestionEditor.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__QuestionEditor.res
index f7929f3433..719a0adebd 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__QuestionEditor.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__QuestionEditor.res
@@ -18,7 +18,7 @@ type state = {
let computeInitialState = question => {
let (title, description) = switch question {
- | Some(question) => (question |> Question.title, question |> Question.description)
+ | Some(question) => (question->Question.title, question->Question.description)
| None => ("", "")
}
@@ -48,7 +48,7 @@ type action =
let reducer = (state, action) =>
switch action {
| UpdateTitle(title) =>
- let similar = title |> String.trim == "" ? {search: "", suggestions: []} : state.similar
+ let similar = title->String.trim == "" ? {search: "", suggestions: []} : state.similar
{...state, title: title, similar: similar}
| UpdateTitleAndTimeout(title, timeoutId) => {
@@ -85,16 +85,16 @@ module SimilarQuestionsQuery = %graphql(`
let searchForSimilarQuestions = (send, title, communityId, ()) => {
send(BeginSearching)
- let trimmedTitle = title |> String.trim
+ let trimmedTitle = title->String.trim
SimilarQuestionsQuery.make(~communityId, ~title=trimmedTitle, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(result => {
- let suggestions = result["similarQuestions"] |> Array.map(QuestionSuggestion.makeFromJs)
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(result => {
+ let suggestions = result["similarQuestions"]->Array.map(QuestionSuggestion.makeFromJs)
send(FinishSearching(trimmedTitle, suggestions))
Js.Promise.resolve()
})
- |> Js.Promise.catch(e => {
+ ->Js.Promise.catch(e => {
Js.log(e)
Notification.warn(
"Oops!",
@@ -103,17 +103,17 @@ let searchForSimilarQuestions = (send, title, communityId, ()) => {
send(FailSaving)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
-let isInvalidString = s => s |> String.trim == ""
+let isInvalidString = s => s->String.trim == ""
let updateTitleAndSearch = (state, send, communityId, title) => {
state.titleTimeoutId->Belt.Option.forEach(Js.Global.clearTimeout)
- let trimmedTitle = title |> String.trim
+ let trimmedTitle = title->String.trim
- if title |> isInvalidString || trimmedTitle == state.similar.search {
+ if title->isInvalidString || trimmedTitle == state.similar.search {
send(UpdateTitle(title))
} else {
let timeoutId = Js.Global.setTimeout(
@@ -183,18 +183,18 @@ module UpdateQuestionError = {
let handleResponseCB = (id, title) => {
let window = Webapi.Dom.window
let parameterizedTitle =
- title |> Js.String.toLowerCase |> Js.String.replaceByRe(/[^0-9a-zA-Z]+/gi, "-")
+ title->Js.String.toLowerCase->Js.String.replaceByRe(/[^0-9a-zA-Z]+/gi, "-")
let redirectPath = "/questions/" ++ (id ++ ("/" ++ parameterizedTitle))
- redirectPath |> Webapi.Dom.Window.setLocation(window)
+ redirectPath->Webapi.Dom.Window.setLocation(window)
}
-let handleBack = () => Webapi.Dom.window |> Webapi.Dom.Window.history |> Webapi.Dom.History.back
+let handleBack = () => Webapi.Dom.window->Webapi.Dom.Window.history->Webapi.Dom.History.back
module CreateQuestionErrorHandler = GraphqlErrorHandler.Make(CreateQuestionError)
module UpdateQuestionErrorHandler = GraphqlErrorHandler.Make(UpdateQuestionError)
-let saveDisabled = state => state.description |> isInvalidString || state.title |> isInvalidString
+let saveDisabled = state => state.description->isInvalidString || state.title->isInvalidString
let handleCreateOrUpdateQuestion = (
state,
@@ -205,17 +205,17 @@ let handleCreateOrUpdateQuestion = (
updateQuestionCB,
event,
) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
if !saveDisabled(state) {
send(BeginSaving)
switch question {
| Some(question) =>
- let id = question |> Question.id
+ let id = question->Question.id
UpdateQuestionQuery.make(~id, ~title=state.title, ~description=state.description, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response =>
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response =>
switch response["updateQuestion"] {
| #Success(updated) =>
switch (updated, updateQuestionCB) {
@@ -229,10 +229,10 @@ let handleCreateOrUpdateQuestion = (
| #Errors(errors) => Js.Promise.reject(UpdateQuestionErrorHandler.Errors(errors))
}
)
- |> UpdateQuestionErrorHandler.catch(() => send(FailSaving))
- |> ignore
+ ->UpdateQuestionErrorHandler.catch(() => send(FailSaving))
+ ->ignore
| None =>
- let targetId = target |> OptionUtils.map(LinkedTarget.id)
+ let targetId = target->OptionUtils.map(LinkedTarget.id)
CreateQuestionQuery.make(
~description=state.description,
@@ -241,8 +241,8 @@ let handleCreateOrUpdateQuestion = (
~targetId?,
(),
)
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response =>
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response =>
switch response["createQuestion"] {
| #QuestionId(questionId) =>
handleResponseCB(questionId, state.title)
@@ -251,8 +251,8 @@ let handleCreateOrUpdateQuestion = (
| #Errors(errors) => Js.Promise.reject(CreateQuestionErrorHandler.Errors(errors))
}
)
- |> CreateQuestionErrorHandler.catch(() => send(FailSaving))
- |> ignore
+ ->CreateQuestionErrorHandler.catch(() => send(FailSaving))
+ ->ignore
}
} else {
Notification.error("Error!", "Question title and description must be present.")
@@ -262,53 +262,53 @@ let handleCreateOrUpdateQuestion = (
let suggestions = state => {
let suggestions = state.similar.suggestions
- suggestions |> ArrayUtils.isNotEmpty
+ suggestions->ArrayUtils.isNotEmpty
?
: React.null
}
let searchingIndicator = state =>
- state.similar.suggestions |> ArrayUtils.isEmpty && state.searching
+ state.similar.suggestions->ArrayUtils.isEmpty && state.searching
?
@@ -325,7 +325,7 @@ let make = (~communityId, ~showBackButton=true, ~target, ~question=?, ~updateQue
?
: React.null}
@@ -336,10 +336,10 @@ let make = (~communityId, ~showBackButton=true, ~target, ~question=?, ~updateQue
- {"Linked Target: " |> str}
- {target |> LinkedTarget.title |> str}
+ {"Linked Target: "->str}
+ {target->LinkedTarget.title->str}
-
{"Clear" |> str}
+
{"Clear"->str}
| None => React.null
@@ -348,7 +348,7 @@ let make = (~communityId, ~showBackButton=true, ~target, ~question=?, ~updateQue
{switch question {
| Some(_) => "Edit question"
| None => "Ask a new question"
- } |> str}
+ }->str}
- {"Question" |> str}
+ {"Question"->str}
- {"Description" |> str}
+ {"Description"->str}
"Update Question"
| None => "Post Your Question"
- } |> str}
+ }->str}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__QuestionSuggestion.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__QuestionSuggestion.res
index 1b9f508558..e4e6c7c468 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__QuestionSuggestion.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__QuestionSuggestion.res
@@ -13,6 +13,6 @@ let answersCount = t => t.answersCount
let makeFromJs = jsObject => {
id: jsObject["id"],
title: jsObject["title"],
- createdAt: jsObject["createdAt"] |> Json.Decode.string |> DateFns.parseString,
+ createdAt: jsObject["createdAt"]->Json.Decode.string->DateFns.parseString,
answersCount: jsObject["answersCount"],
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Target.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Target.res
index 7610934ed2..e5c848c8c0 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Target.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__Target.res
@@ -9,7 +9,7 @@ let title = t => t.title
let decode = json => {
open Json.Decode
{
- id: json |> field("id", nullable(string)) |> Js.Null.toOption,
- title: json |> field("title", string),
+ id: json->field("id", nullable(string))->Js.Null.toOption,
+ title: json->field("title", string),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__User.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__User.res
index 7c9f009a6b..d18bd5fa60 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__User.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__User.res
@@ -8,10 +8,10 @@ type t = {
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- name: json |> field("name", string),
- avatarUrl: json |> field("avatarUrl", string),
- title: json |> field("title", string),
+ id: json->field("id", string),
+ name: json->field("name", string),
+ avatarUrl: json->field("avatarUrl", string),
+ title: json->field("title", string),
}
}
@@ -22,7 +22,7 @@ let avatarUrl = t => t.avatarUrl
let title = t => t.title
let findById = (id, users) =>
- users |> ListUtils.unsafeFind(
+ users->ListUtils.unsafeFind(
user => user.id == id,
"Unable to find user with id " ++ (id ++ "in QuestionShow__UserData"),
)
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__UserShow.res b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__UserShow.res
index 6a0284af1d..0dee905032 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__UserShow.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/questions/QuestionsShow__UserShow.res
@@ -8,17 +8,17 @@ let make = (~user, ~createdAt, ~textForTimeStamp) =>
{textForTimeStamp ++
(" on " ++
- (createdAt |> DateFns.parseString |> DateFns.format("Do MMMM, YYYY HH:mm"))) |> str}
+ (createdAt->DateFns.parseString->DateFns.format("Do MMMM, YYYY HH:mm")))->str}
-

User.avatarUrl} />
+

User.avatarUrl} />
-
{user |> User.name |> str}
-
{user |> User.title |> str}
+
{user->User.name->str}
+
{user->User.title->str}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CoachesSchoolIndex__Coach.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CoachesSchoolIndex__Coach.res
index 01102f36b6..6f63abad01 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CoachesSchoolIndex__Coach.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CoachesSchoolIndex__Coach.res
@@ -37,17 +37,17 @@ let affiliation = t => t.affiliation
let decode = json => {
open Json.Decode
{
- name: json |> field("name", string),
- id: json |> field("id", int),
- imageUrl: json |> field("imageUrl", string),
- email: json |> field("email", string),
- title: json |> field("title", string),
- linkedinUrl: json |> field("linkedinUrl", nullable(string)) |> Js.Null.toOption,
- public: json |> field("public", bool),
- connectLink: json |> field("connectLink", nullable(string)) |> Js.Null.toOption,
- exited: json |> field("exited", bool),
- imageFileName: json |> field("imageFileName", nullable(string)) |> Js.Null.toOption,
- affiliation: json |> field("affiliation", nullable(string)) |> Js.Null.toOption,
+ name: json->field("name", string),
+ id: json->field("id", int),
+ imageUrl: json->field("imageUrl", string),
+ email: json->field("email", string),
+ title: json->field("title", string),
+ linkedinUrl: json->field("linkedinUrl", nullable(string))->Js.Null.toOption,
+ public: json->field("public", bool),
+ connectLink: json->field("connectLink", nullable(string))->Js.Null.toOption,
+ exited: json->field("exited", bool),
+ imageFileName: json->field("imageFileName", nullable(string))->Js.Null.toOption,
+ affiliation: json->field("affiliation", nullable(string))->Js.Null.toOption,
}
}
@@ -78,6 +78,6 @@ let make = (
}
let updateList = (coaches, coach) => {
- let oldList = coaches |> List.filter(t => t.id !== coach.id)
- oldList |> List.rev |> List.append(list{coach}) |> List.rev |> List.sort((x, y) => x.id - y.id)
+ let oldList = coaches->List.filter(t => t.id !== coach.id)
+ oldList->List.rev->List.append(list{coach})->List.rev->List.sort((x, y) => x.id - y.id)
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Author.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Author.res
index 78f0756f40..6f3b5de2d0 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Author.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Author.res
@@ -13,10 +13,10 @@ let email = t => t.email
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- email: json |> field("email", string),
- name: json |> field("name", string),
- avatarUrl: json |> optional(field("avatarUrl", string)),
+ id: json->field("id", string),
+ email: json->field("email", string),
+ name: json->field("name", string),
+ avatarUrl: json->optional(field("avatarUrl", string)),
}
}
@@ -27,6 +27,6 @@ let create = (~id, ~name, ~email, ~avatarUrl) => {
avatarUrl: avatarUrl,
}
-let sort = l => l |> ArrayUtils.copyAndSort((x, y) => x.name < y.name ? -1 : 1)
+let sort = l => l->ArrayUtils.copyAndSort((x, y) => x.name < y.name ? -1 : 1)
let updateName = (name, t) => {...t, name: name}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Form.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Form.res
index a4ff6fcbcf..d84b629853 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Form.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Form.res
@@ -24,8 +24,8 @@ module UpdateCourseAuthorQuery = %graphql(`
let createCourseAuthorQuery = (courseId, rootPath, email, name, setSaving, addAuthorCB) => {
setSaving(_ => true)
CreateCourseAuthorQuery.make(~courseId, ~email, ~name, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
switch response["createCourseAuthor"]["courseAuthor"] {
| Some(courseAuthor) =>
addAuthorCB(
@@ -37,21 +37,21 @@ let createCourseAuthorQuery = (courseId, rootPath, email, name, setSaving, addAu
}
Js.Promise.resolve()
})
- |> Js.Promise.catch(_ => {
+ ->Js.Promise.catch(_ => {
setSaving(_ => false)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let updateCourseAuthorQuery = (rootPath, author, name, setSaving, updateAuthorCB) => {
setSaving(_ => true)
- let id = author |> Author.id
+ let id = author->Author.id
UpdateCourseAuthorQuery.make(~id, ~name, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
if response["updateCourseAuthor"]["success"] {
- updateAuthorCB(author |> Author.updateName(name))
+ updateAuthorCB(author->Author.updateName(name))
ReasonReactRouter.push(rootPath)
} else {
setSaving(_ => false)
@@ -59,11 +59,11 @@ let updateCourseAuthorQuery = (rootPath, author, name, setSaving, updateAuthorCB
Js.Promise.resolve()
})
- |> Js.Promise.catch(_ => {
+ ->Js.Promise.catch(_ => {
setSaving(_ => false)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let handleButtonClick = (
@@ -77,14 +77,14 @@ let handleButtonClick = (
updateAuthorCB,
event,
) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
switch author {
| Some(author) => updateCourseAuthorQuery(rootPath, author, name, setSaving, updateAuthorCB)
| None => createCourseAuthorQuery(courseId, rootPath, email, name, setSaving, addAuthorCB)
}
}
-let isInvalidEmail = email => email |> EmailUtils.isInvalid(false)
+let isInvalidEmail = email => email->EmailUtils.isInvalid(false)
let showInvalidEmailError = (email, author) =>
switch author {
@@ -102,7 +102,7 @@ let saveDisabled = (email, name, saving, author) =>
(saving ||
(name == "" ||
switch author {
- | Some(author) => author |> Author.name == name && author |> Author.email == email
+ | Some(author) => author->Author.name == name && author->Author.email == email
| None => false
}))
@@ -125,14 +125,14 @@ let make = (~courseId, ~rootPath, ~author, ~addAuthorCB, ~updateAuthorCB) => {
let (name, setName) = React.useState(() =>
switch author {
- | Some(author) => author |> Author.name
+ | Some(author) => author->Author.name
| None => ""
}
)
let (email, setEmail) = React.useState(() =>
switch author {
- | Some(author) => author |> Author.email
+ | Some(author) => author->Author.email
| None => ""
}
)
@@ -143,15 +143,15 @@ let make = (~courseId, ~rootPath, ~author, ~addAuthorCB, ~updateAuthorCB) => {
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Root.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Root.res
index 3ac4d2468c..3fdb65f46b 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Root.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseAuthors__Root.res
@@ -22,16 +22,16 @@ let reducer = (state, action) =>
| FailToDelete => {...state, deleting: false}
| FinishDeleting(author) => {
deleting: false,
- authors: state.authors |> Js.Array.filter(a => a |> Author.id != (author |> Author.id)),
+ authors: state.authors->Js.Array.filter(a => a->Author.id != (author->Author.id)),
}
| AddAuthor(author) => {
...state,
- authors: state.authors |> Js.Array.concat([author]),
+ authors: state.authors->Js.Array.concat([author]),
}
| UpdateAuthor(author) => {
...state,
- authors: state.authors |> Array.map(a =>
- a |> Author.id == (author |> Author.id) ? author : a
+ authors: state.authors->Array.map(a =>
+ a->Author.id == (author->Author.id) ? author : a
),
}
}
@@ -45,16 +45,16 @@ module DeleteCourseAuthorQuery = %graphql(`
`)
let removeCourseAuthor = (send, author, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
WindowUtils.confirm(
- "Are you sure you want to remove " ++ ((author |> Author.name) ++ " from the list of authors?"),
+ "Are you sure you want to remove " ++ ((author->Author.name) ++ " from the list of authors?"),
() => {
send(BeginDeleting)
- DeleteCourseAuthorQuery.make(~id=author |> Author.id, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ DeleteCourseAuthorQuery.make(~id=author->Author.id, ())
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
if response["deleteCourseAuthor"]["success"] {
send(FinishDeleting(author))
} else {
@@ -63,18 +63,18 @@ let removeCourseAuthor = (send, author, event) => {
Js.Promise.resolve()
})
- |> Js.Promise.catch(_ => {
+ ->Js.Promise.catch(_ => {
send(FailToDelete)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
},
)
}
let renderAuthor = (rootPath, author, send) => {
- let authorPath = rootPath ++ ("/" ++ (author |> Author.id))
-
Author.id} className="flex w-1/2 flex-shrink-0 mb-5 px-3">
+ let authorPath = rootPath ++ ("/" ++ (author->Author.id))
+
Author.id} className="flex w-1/2 flex-shrink-0 mb-5 px-3">
{
}}>
- {switch author |> Author.avatarUrl {
+ {switch author->Author.avatarUrl {
| Some(avatarUrl) =>
- | None => Author.name} className="w-10 h-10 rounded-full" />
+ | None => Author.name} className="w-10 h-10 rounded-full" />
}}
- {author |> Author.name |> str}
+ {author->Author.name->str}
- {author |> Author.email |> str}
+ {author->Author.email->str}
Author.name)}
+ title={"Delete " ++ (author->Author.name)}
onClick={removeCourseAuthor(send, author)}>
@@ -128,8 +128,8 @@ let make = (~courseId, ~authors) => {
None
} else {
Some(
- state.authors |> ArrayUtils.unsafeFind(
- author => author |> Author.id == authorId,
+ state.authors->ArrayUtils.unsafeFind(
+ author => author->Author.id == authorId,
"Could not find author with ID " ++
(authorId ++
(" in the list of known authors for course with ID " ++ courseId)),
@@ -155,16 +155,16 @@ let make = (~courseId, ~authors) => {
onClick={_ => ReasonReactRouter.push(rootPath ++ "/new")}
className="max-w-2xl w-full flex mx-auto items-center justify-center relative bg-white text-primary-500 hover:bg-gray-100 hover:text-primary-600 hover:shadow-lg focus:outline-none border-2 border-gray-400 border-dashed hover:border-primary-300 p-6 rounded-lg mt-8 cursor-pointer">
-
{"Add New Author" |> str}
+
{"Add New Author"->str}
{state.authors
- |> Author.sort
- |> Array.map(author => renderAuthor(rootPath, author, send))
- |> ReasonReact.array}
+ ->Author.sort
+ ->Array.map(author => renderAuthor(rootPath, author, send))
+ ->ReasonReact.array}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__CourseCoach.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__CourseCoach.res
index 6ba5c959ac..ef794ee58b 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__CourseCoach.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__CourseCoach.res
@@ -19,10 +19,10 @@ let title = t => t.title
let decode = json => {
open Json.Decode
{
- name: json |> field("name", string),
- email: json |> field("email", string),
- id: json |> field("id", string),
- avatarUrl: json |> optional(field("avatarUrl", string)),
- title: json |> field("title", string),
+ name: json->field("name", string),
+ email: json->field("email", string),
+ id: json->field("id", string),
+ avatarUrl: json->optional(field("avatarUrl", string)),
+ title: json->field("title", string),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__EnrollmentForm.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__EnrollmentForm.res
index f9a2770f4a..922a70c4c9 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__EnrollmentForm.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__EnrollmentForm.res
@@ -23,12 +23,12 @@ let reducer = (state, action) =>
let makePayload = state => {
let payload = Js.Dict.empty()
- Js.Dict.set(payload, "authenticity_token", AuthenticityToken.fromHead() |> Js.Json.string)
+ Js.Dict.set(payload, "authenticity_token", AuthenticityToken.fromHead()->Js.Json.string)
Js.Dict.set(
payload,
"coach_ids",
- state.courseCoaches |> {
+ state.courseCoaches->{
open Json.Encode
array(string)
},
@@ -40,20 +40,20 @@ let makePayload = state => {
module SelectableCourseCoaches = {
type t = SchoolCoach.t
- let value = t => t |> SchoolCoach.name
+ let value = t => t->SchoolCoach.name
let searchString = value
}
let setCoachSearchInput = (send, value) => send(UpdateCoachSearchInput(value))
let selectCoach = (send, state, coach) => {
- let updatedCoaches = state.courseCoaches |> Js.Array.concat([coach |> SchoolCoach.id])
+ let updatedCoaches = state.courseCoaches->Js.Array.concat([coach->SchoolCoach.id])
send(UpdateCoachesList(updatedCoaches))
}
let deSelectCoach = (send, state, coach) => {
let updatedCoaches =
- state.courseCoaches |> Js.Array.filter(coachId => coachId != SchoolCoach.id(coach))
+ state.courseCoaches->Js.Array.filter(coachId => coachId != SchoolCoach.id(coach))
send(UpdateCoachesList(updatedCoaches))
}
@@ -61,9 +61,9 @@ module MultiselectForCourseCoaches = MultiselectInline.Make(SelectableCourseCoac
let courseCoachEditor = (coaches, state, send) => {
let selected =
- coaches |> Js.Array.filter(coach => state.courseCoaches |> Array.mem(SchoolCoach.id(coach)))
+ coaches->Js.Array.filter(coach => state.courseCoaches->Array.mem(SchoolCoach.id(coach)))
let unselected =
- coaches |> Js.Array.filter(coach => !(state.courseCoaches |> Array.mem(SchoolCoach.id(coach))))
+ coaches->Js.Array.filter(coach => !(state.courseCoaches->Array.mem(SchoolCoach.id(coach))))
{
}
let handleResponseCB = (updateCoachesCB, json) => {
- let courseCoaches = json |> {
+ let courseCoaches = json->{
open Json.Decode
field("course_coaches", array(CourseCoach.decode))
}
@@ -96,8 +96,8 @@ let updateCourseCoaches = (state, send, courseId, updateCoachesCB) => {
}
let computeAvailableCoaches = (schoolCoaches, courseCoaches) => {
- let courseCoachIds = courseCoaches |> Array.map(CourseCoach.id)
- schoolCoaches |> Js.Array.filter(coach => !(courseCoachIds |> Array.mem(coach |> SchoolCoach.id)))
+ let courseCoachIds = courseCoaches->Array.map(CourseCoach.id)
+ schoolCoaches->Js.Array.filter(coach => !(courseCoachIds->Array.mem(coach->SchoolCoach.id)))
}
@react.component
@@ -109,20 +109,20 @@ let make = (~schoolCoaches, ~courseCoaches, ~courseId, ~updateCoachesCB) => {
let coaches = computeAvailableCoaches(schoolCoaches, courseCoaches)
- let saveDisabled = state.courseCoaches |> ArrayUtils.isEmpty || state.saving
+ let saveDisabled = state.courseCoaches->ArrayUtils.isEmpty || state.saving
- {"ASSIGN COACHES TO THE COURSE" |> str}
+ {"ASSIGN COACHES TO THE COURSE"->str}
- {coaches |> Array.length > 0
+ {coaches->Array.length > 0
?
- {"Select coaches:" |> str}
+ {"Select coaches:"->str}
{courseCoachEditor(coaches, state, send)}
@@ -134,7 +134,7 @@ let make = (~schoolCoaches, ~courseCoaches, ~courseId, ~updateCoachesCB) => {
disabled=saveDisabled
onClick={_e => updateCourseCoaches(state, send, courseId, updateCoachesCB)}
className="w-full btn btn-primary btn-large">
- {"Add Course Coaches" |> str}
+ {"Add Course Coaches"->str}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__InfoForm.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__InfoForm.res
index 3ebcef3d06..b55dafd0b7 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__InfoForm.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__InfoForm.res
@@ -24,7 +24,7 @@ let reducer = (state, action) =>
| LoadCoachInfo(teams, stats) => {teams: teams, stats: stats, loading: false}
| RemoveTeam(id) => {
...state,
- teams: state.teams |> Js.Array.filter(team => Team.id(team) != id),
+ teams: state.teams->Js.Array.filter(team => Team.id(team) != id),
}
}
@@ -49,10 +49,10 @@ module CoachInfoQuery = %graphql(`
let loadCoachTeams = (courseId, coachId, send) =>
CoachInfoQuery.make(~courseId, ~coachId, ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(result => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(result => {
let coachTeams =
- result["teams"]["nodes"] |> OptionUtils.mapWithDefault(Team.makeArrayFromJs, [])
+ result["teams"]["nodes"]->OptionUtils.mapWithDefault(Team.makeArrayFromJs, [])
let stats = {
reviewedSubmissions: result["coachStats"]["reviewedSubmissions"],
@@ -62,7 +62,7 @@ let loadCoachTeams = (courseId, coachId, send) =>
send(LoadCoachInfo(coachTeams, stats))
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
let removeTeamEnrollment = (send, teamId) => send(RemoveTeam(teamId))
@@ -71,22 +71,22 @@ let make = (~courseId, ~coach) => {
let (state, send) = React.useReducer(reducer, initialState)
React.useEffect1(() => {
- loadCoachTeams(courseId, coach |> CourseCoach.id, send)
+ loadCoachTeams(courseId, coach->CourseCoach.id, send)
None
}, [courseId])
- {switch coach |> CourseCoach.avatarUrl {
+ {switch coach->CourseCoach.avatarUrl {
| Some(avatarUrl) =>

- | None =>
CourseCoach.name} className="w-12 h-12 mr-4" />
+ | None => CourseCoach.name} className="w-12 h-12 mr-4" />
}}
- {coach |> CourseCoach.name |> str}
+ {coach->CourseCoach.name->str}
-
{coach |> CourseCoach.email |> str}
+
{coach->CourseCoach.email->str}
@@ -101,37 +101,37 @@ let make = (~courseId, ~coach) => {
- {"Reviewed submissions" |> str}
+ {"Reviewed submissions"->str}
- {state.stats.reviewedSubmissions |> string_of_int |> str}
+ {state.stats.reviewedSubmissions->string_of_int->str}
- {"Pending submissions" |> str}
+ {"Pending submissions"->str}
- {state.stats.pendingSubmissions |> string_of_int |> str}
+ {state.stats.pendingSubmissions->string_of_int->str}
}
- {"Students assigned to coach:" |> str}
+ {"Students assigned to coach:"->str}
{state.loading
?
{SkeletonLoading.multiple(~count=2, ~element=SkeletonLoading.paragraph())}
:
- {state.teams |> ArrayUtils.isEmpty
+ {state.teams->ArrayUtils.isEmpty
?
- {"There are no students assigned to this coach. You can assign coaches directly while editing the student details." |> str}
+ {"There are no students assigned to this coach. You can assign coaches directly while editing the student details."->str}
: state.teams
- |> Array.map(team =>
+ ->Array.map(team =>
{
removeTeamEnrollmentCB={removeTeamEnrollment(send)}
/>
)
- |> React.array}
+ ->React.array}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__InfoFormTeam.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__InfoFormTeam.res
index 8d662cc254..57a55194a0 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__InfoFormTeam.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__InfoFormTeam.res
@@ -13,25 +13,25 @@ module DeleteCoachTeamEnrollmentQuery = %graphql(`
`)
let deleteTeamEnrollment = (team, coach, setDeleting, removeTeamEnrollmentCB, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
WindowUtils.confirm(
"Are you sure you want to remove " ++
- ((team |> Team.name) ++
+ ((team->Team.name) ++
" from the list of assigned teams?"),
() => {
setDeleting(_ => true)
DeleteCoachTeamEnrollmentQuery.make(~teamId=Team.id(team), ~coachId=CourseCoach.id(coach), ())
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(response => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(response => {
if response["deleteCoachTeamEnrollment"]["success"] {
removeTeamEnrollmentCB(Team.id(team))
} else {
setDeleting(_ => false)
}
- response |> Js.Promise.resolve
+ response->Js.Promise.resolve
})
- |> ignore
+ ->ignore
},
)
}
@@ -40,22 +40,22 @@ let deleteTeamEnrollment = (team, coach, setDeleting, removeTeamEnrollmentCB, ev
let make = (~team, ~coach, ~removeTeamEnrollmentCB) => {
let (deleting, setDeleting) = React.useState(() => false)
Team.name)}
+ ariaLabel={"Team " ++ (team->Team.name)}
className="flex items-center justify-between bg-gray-100 text-xs text-gray-900 border rounded pl-3 mt-2"
- key={team |> Team.id}>
+ key={team->Team.id}>
{team
- |> Team.students
- |> Js.Array.mapi((student, index) =>
-
string_of_int}> {student |> str}
+ ->Team.students
+ ->Js.Array.mapi((student, index) =>
+
string_of_int}> {student->str}
)
- |> React.array}
+ ->React.array}
- {team |> Team.students |> Array.length > 1
+ {team->Team.students->Array.length > 1
?
-
{"Team" |> str}
-
{team |> Team.name |> str}
+
{"Team"->str}
+
{team->Team.name->str}
: React.null}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__Root.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__Root.res
index 54541f9daa..eaa807acd3 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__Root.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__Root.res
@@ -24,11 +24,11 @@ let reducer = (state, action) =>
| UpdateFormVisible(formVisible) => {...state, formVisible: formVisible}
| AddCourseCoaches(courseCoaches) => {
...state,
- courseCoaches: state.courseCoaches |> Array.append(courseCoaches),
+ courseCoaches: state.courseCoaches->Array.append(courseCoaches),
}
| RemoveCoach(coachId) => {
...state,
- courseCoaches: state.courseCoaches |> Js.Array.filter(courseCoach =>
+ courseCoaches: state.courseCoaches->Js.Array.filter(courseCoach =>
CourseCoach.id(courseCoach) !== coachId
),
}
@@ -42,7 +42,7 @@ let handleErrorCB = (send, ()) => {
let handleResponseCB = (send, json) => {
send(UpdateSaving)
- let coachId = json |> {
+ let coachId = json->{
open Json.Decode
field("coach_id", string)
}
@@ -51,19 +51,19 @@ let handleResponseCB = (send, json) => {
}
let removeCoach = (send, courseId, authenticityToken, coach, event) => {
- event |> ReactEvent.Mouse.preventDefault
+ event->ReactEvent.Mouse.preventDefault
if {
open Webapi.Dom
- window |> Window.confirm(
- "Are you sure you want to remove " ++ ((coach |> CourseCoach.name) ++ " from this course?"),
+ window->Window.confirm(
+ "Are you sure you want to remove " ++ ((coach->CourseCoach.name) ++ " from this course?"),
)
} {
send(UpdateSaving)
let url = "/school/courses/" ++ (courseId ++ "/delete_coach_enrollment")
let payload = Js.Dict.empty()
- Js.Dict.set(payload, "authenticity_token", authenticityToken |> Js.Json.string)
- Js.Dict.set(payload, "coach_id", coach |> CourseCoach.id |> Js.Json.string)
+ Js.Dict.set(payload, "authenticity_token", authenticityToken->Js.Json.string)
+ Js.Dict.set(payload, "coach_id", coach->CourseCoach.id->Js.Json.string)
Api.create(url, payload, handleResponseCB(send), handleErrorCB(send))
} else {
()
@@ -113,25 +113,25 @@ let make = (~courseCoaches, ~schoolCoaches, ~courseId, ~authenticityToken) => {
}}
className="max-w-2xl w-full flex mx-auto items-center justify-center relative bg-white text-primary-500 hove:bg-gray-100 hover:text-primary-600 hover:shadow-lg focus:outline-none border-2 border-gray-400 border-dashed hover:border-primary-300 p-6 rounded-lg mt-8 cursor-pointer">
-
{"Assign Coaches to Course" |> str}
+
{"Assign Coaches to Course"->str}
}
- {state.courseCoaches |> ArrayUtils.isEmpty
+ {state.courseCoaches->ArrayUtils.isEmpty
?
- {"The course has no coaches assigned!" |> str}
+ {"The course has no coaches assigned!"->str}
: React.null}
{state.courseCoaches->Belt.SortArray.stableSortBy((a, b) =>
- String.compare(a |> CourseCoach.name, b |> CourseCoach.name)
+ String.compare(a->CourseCoach.name, b->CourseCoach.name)
)
- |> Array.map(coach =>
-
CourseCoach.id} className="flex w-1/2 flex-shrink-0 mb-5 px-3">
+ ->Array.map(coach =>
+
CourseCoach.id} className="flex w-1/2 flex-shrink-0 mb-5 px-3">
CourseCoach.name}
+ id={coach->CourseCoach.name}
className="shadow bg-whzite cursor-pointer rounded-lg flex w-full border border-transparent overflow-hidden hover:border-primary-400 hover:bg-gray-100">
{
onClick={_ => send(UpdateFormVisible(CoachInfoForm(coach)))}
className="flex flex-1 py-4 px-4 items-center">
- {switch coach |> CourseCoach.avatarUrl {
+ {switch coach->CourseCoach.avatarUrl {
| Some(avatarUrl) =>
| None =>
CourseCoach.name} className="w-10 h-10 rounded-full"
+ name={coach->CourseCoach.name} className="w-10 h-10 rounded-full"
/>
}}
- {coach |> CourseCoach.name |> str}
+ {coach->CourseCoach.name->str}
- {coach |> CourseCoach.title |> str}
+ {coach->CourseCoach.title->str}
CourseCoach.name)}
+ ariaLabel={"Delete " ++ (coach->CourseCoach.name)}
onClick={removeCoach(send, courseId, authenticityToken, coach)}>
@@ -167,7 +167,7 @@ let make = (~courseCoaches, ~schoolCoaches, ~courseId, ~authenticityToken) => {
)
- |> React.array}
+ ->React.array}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__SchoolCoach.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__SchoolCoach.res
index 632c5ddbf6..97ff19b36f 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__SchoolCoach.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__SchoolCoach.res
@@ -9,7 +9,7 @@ let name = t => t.name
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- name: json |> field("name", string),
+ id: json->field("id", string),
+ name: json->field("name", string),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__Team.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__Team.res
index c90378052d..b12ee11ae9 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__Team.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseCoaches__Team.res
@@ -12,7 +12,7 @@ let students = t => t.students
let makeFromJS = teamData => {
id: teamData["id"],
name: teamData["name"],
- students: teamData["students"] |> Array.map(student => student["name"]),
+ students: teamData["students"]->Array.map(student => student["name"]),
}
let makeArrayFromJs = detailsOfTeams =>
@@ -21,8 +21,8 @@ let makeArrayFromJs = detailsOfTeams =>
let decode = json => {
open Json.Decode
{
- id: json |> field("id", string),
- name: json |> field("name", string),
- students: json |> field("students", array(string)),
+ id: json->field("id", string),
+ name: json->field("name", string),
+ students: json->field("students", array(string)),
}
}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor.res
index 930e6ae655..d419b3bc47 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor.res
@@ -47,7 +47,7 @@ let reducer = (state, action) =>
| UpdateEditorAction(editorAction) => {...state, editorAction: editorAction}
| UpdateCourses(courses) => {...state, courses: courses}
| UpdateCourse(course) =>
- let newCourses = course |> Course.updateList(state.courses)
+ let newCourses = course->Course.updateList(state.courses)
{courses: newCourses, editorAction: Hidden}
}
@@ -58,24 +58,24 @@ let updateCourse = (send, course) => send(UpdateCourse(course))
let courseLinks = course =>
@@ -85,16 +85,16 @@ let make = () => {
React.useEffect0(() => {
CoursesQuery.make()
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(result => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(result => {
let courses =
result["courses"]
- |> Js.Array.map(rawCourse => Course.makeFromJs(rawCourse))
- |> Array.to_list
+ ->Js.Array.map(rawCourse => Course.makeFromJs(rawCourse))
+ ->Array.to_list
send(UpdateCourses(courses))
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
None
})
@@ -117,53 +117,53 @@ let make = () => {
className="max-w-2xl w-full flex mx-auto items-center justify-center relative bg-white text-primary-500 hover:bg-gray-100 hover:text-primary-600 hover:shadow-md focus:outline-none border-2 border-gray-400 border-dashed hover:border-primary-300 p-6 rounded-lg mt-8 cursor-pointer"
onClick={_ => send(UpdateEditorAction(ShowForm(None)))}>
-
{"Add New Course" |> str}
+
{"Add New Course"->str}
{state.courses
- |> Course.sort
- |> List.map(course =>
-
Course.id}>
+ ->Course.sort
+ ->List.map(course =>
+
Course.id}>
Course.id}
+ key={course->Course.id}
className="flex items-center overflow-hidden shadow bg-white rounded-lg mb-4">
- {switch course |> Course.thumbnail {
+ {switch course->Course.thumbnail {
| Some(image) =>
-

Course.imageUrl} />
+

Course.imageUrl} />
| None =>
}}
-
Course.id}>
+
-
{course |> Course.description |> str}
+
{course->Course.description->str}
@@ -172,8 +172,8 @@ let make = () => {
)
- |> Array.of_list
- |> React.array}
+ ->Array.of_list
+ ->React.array}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__Course.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__Course.res
index 67791c0f68..2ca599aa63 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__Course.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__Course.res
@@ -40,16 +40,16 @@ let cover = t => t.cover
let thumbnail = t => t.thumbnail
-let imageUrl = image => image |> Image.url
+let imageUrl = image => image->Image.url
-let filename = image => image |> Image.filename
+let filename = image => image->Image.filename
let sort = courses =>
- courses |> List.sort((x, y) => (x.id |> int_of_string) - (y.id |> int_of_string))
+ courses->List.sort((x, y) => (x.id->int_of_string) - (y.id->int_of_string))
let updateList = (courses, course) => {
- let oldCourses = courses |> List.filter(c => c.id !== course.id)
- oldCourses |> List.rev |> List.append(list{course}) |> List.rev
+ let oldCourses = courses->List.filter(c => c.id !== course.id)
+ oldCourses->List.rev->List.append(list{course})->List.rev
}
let makeImageFromJs = data =>
@@ -96,7 +96,7 @@ let replaceImages = (cover, thumbnail, t) => {...t, cover: cover, thumbnail: thu
let makeFromJs = rawCourse => {
let endsAt = switch rawCourse["endsAt"] {
- | Some(endsAt) => Some(endsAt |> Json.Decode.string) |> OptionUtils.map(DateFns.parseString)
+ | Some(endsAt) => Some(endsAt->Json.Decode.string)->OptionUtils.map(DateFns.parseString)
| None => None
}
create(
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__Form.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__Form.res
index 0381163e7c..c3e892cc24 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__Form.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__Form.res
@@ -67,12 +67,12 @@ module UpdateCourseQuery = %graphql(`
`)
let updateName = (send, name) => {
- let hasError = name |> String.trim |> String.length < 2
+ let hasError = name->String.trim->String.length < 2
send(UpdateName(name, hasError))
}
let updateDescription = (send, description) => {
- let lengthOfDescription = description |> String.trim |> String.length
+ let lengthOfDescription = description->String.trim->String.length
let hasError = lengthOfDescription < 2 || lengthOfDescription >= 150
send(UpdateDescription(description, hasError))
}
@@ -89,7 +89,7 @@ let formClasses = value =>
let handleResponseCB = (id, state, updateCourseCB, course) => {
let (thumbnail, cover) = switch course {
- | Some(c) => (c |> Course.thumbnail, c |> Course.cover)
+ | Some(c) => (c->Course.thumbnail, c->Course.cover)
| None => (None, None)
}
@@ -114,7 +114,7 @@ let createCourse = (state, send, updateCourseCB) => {
let createCourseQuery = CreateCourseQuery.make(
~name=state.name,
~description=state.description,
- ~endsAt=?state.endsAt |> OptionUtils.map(Date.iso8601) |> OptionUtils.map(Js.Json.string),
+ ~endsAt=?state.endsAt->OptionUtils.map(Date.iso8601)->OptionUtils.map(Js.Json.string),
~about=state.about,
~publicSignup=state.publicSignup,
~featured=state.featured,
@@ -122,22 +122,22 @@ let createCourse = (state, send, updateCourseCB) => {
)
createCourseQuery
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(result => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(result => {
handleResponseCB(result["createCourse"]["course"]["id"], state, updateCourseCB, None)
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let updateCourse = (state, send, updateCourseCB, course) => {
send(UpdateSaving)
let updateCourseQuery = UpdateCourseQuery.make(
- ~id=course |> Course.id,
+ ~id=course->Course.id,
~name=state.name,
~description=state.description,
- ~endsAt=?state.endsAt |> OptionUtils.map(Date.iso8601) |> OptionUtils.map(Js.Json.string),
+ ~endsAt=?state.endsAt->OptionUtils.map(Date.iso8601)->OptionUtils.map(Js.Json.string),
~about=state.about,
~publicSignup=state.publicSignup,
~featured=state.featured,
@@ -145,12 +145,12 @@ let updateCourse = (state, send, updateCourseCB, course) => {
)
updateCourseQuery
- |> GraphqlQuery.sendQuery
- |> Js.Promise.then_(result => {
+ ->GraphqlQuery.sendQuery
+ ->Js.Promise.then_(result => {
handleResponseCB(result["updateCourse"]["course"]["id"], state, updateCourseCB, Some(course))
Js.Promise.resolve()
})
- |> ignore
+ ->ignore
}
let booleanButtonClasses = bool => {
@@ -161,7 +161,7 @@ let booleanButtonClasses = bool => {
let enablePublicSignupButton = (publicSignup, send) =>
send(UpdatePublicSignup(true))}>
- {"Yes" |> str}
+ {"Yes"->str}
send(UpdatePublicSignup(false))}>
- {"No" |> str}
+ {"No"->str}
@@ -182,22 +182,22 @@ let enablePublicSignupButton = (publicSignup, send) =>
let featuredButton = (featured, send) =>
send(UpdateFeatured(true))}>
- {"Yes" |> str}
+ {"Yes"->str}
send(UpdateFeatured(false))}>
- {"No" |> str}
+ {"No"->str}
let about = course =>
- switch course |> Course.about {
+ switch course->Course.about {
| Some(about) => about
| None => ""
}
@@ -207,17 +207,17 @@ let updateAboutCB = (send, about) => send(UpdateAbout(about))
let computeInitialState = course =>
switch course {
| Some(course) => {
- name: course |> Course.name,
- description: course |> Course.description,
- endsAt: course |> Course.endsAt,
+ name: course->Course.name,
+ description: course->Course.description,
+ endsAt: course->Course.endsAt,
hasNameError: false,
hasDateError: false,
hasDescriptionError: false,
dirty: false,
saving: false,
about: about(course),
- publicSignup: course |> Course.publicSignup,
- featured: course |> Course.featured,
+ publicSignup: course->Course.publicSignup,
+ featured: course->Course.featured,
}
| None => {
name: "",
@@ -253,11 +253,11 @@ let make = (~course, ~hideEditorActionCB, ~updateCourseCB) => {
- {(course == None ? "Add New Course" : "Edit Course Details") |> str}
+ {(course == None ? "Add New Course" : "Edit Course Details")->str}
{
{
- {"(optional)" |> str}
+ {"(optional)"->str}
- {"If specified, course will appear as closed to students on this date. Students will not be able to make any more submissions." |> str}
+ {"If specified, course will appear as closed to students on this date. Students will not be able to make any more submissions."->str}
send(UpdateEndsAt(date))}
@@ -331,7 +331,7 @@ let make = (~course, ~hideEditorActionCB, ~updateCourseCB) => {
disabled={saveDisabled(state)}
onClick={_ => updateCourse(state, send, updateCourseCB, course)}
className="w-full btn btn-large btn-primary mt-3">
- {"Update Course" |> str}
+ {"Update Course"->str}
| None =>
@@ -339,7 +339,7 @@ let make = (~course, ~hideEditorActionCB, ~updateCourseCB) => {
disabled={saveDisabled(state)}
onClick={_ => createCourse(state, send, updateCourseCB)}
className="w-full btn btn-large btn-primary mt-3">
- {"Create Course" |> str}
+ {"Create Course"->str}
}}
diff --git a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__ImagesForm.res b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__ImagesForm.res
index eb298ecd4e..480f5966e7 100644
--- a/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__ImagesForm.res
+++ b/tests/syntax_tests/data/idempotency/pupilfirst/schools/CourseEditor__ImagesForm.res
@@ -22,20 +22,20 @@ let updateButtonText = updating => updating ? "Updating..." : "Update Images"
let formId = "course-editor-form-image-form"
-let filename = optionalFilename => optionalFilename |> OptionUtils.default("unknown")
+let filename = optionalFilename => optionalFilename->OptionUtils.default("unknown")
let handleUpdateCB = (json, state, course, updateCourseCB) => {
- let coverUrl = json |> {
+ let coverUrl = json->{
open Json.Decode
field("cover_url", optional(string))
}
- let thumbnailUrl = json |> {
+ let thumbnailUrl = json->{
open Json.Decode
field("thumbnail_url", optional(string))
}
let newCourse =
- course |> Course.addImages(
+ course->Course.addImages(
~coverUrl,
~thumbnailUrl,
~coverFilename=filename(state.filenameCover),
@@ -46,14 +46,14 @@ let handleUpdateCB = (json, state, course, updateCourseCB) => {
}
let handleUpdateImages = (send, state, course, updateCourseCB, event) => {
- event |> ReactEvent.Form.preventDefault
+ event->ReactEvent.Form.preventDefault
send(BeginUpdate)
let element = ReactDOMRe._getElementById(formId)
switch element {
| Some(element) =>
Api.sendFormData(
- "courses/" ++ ((course |> Course.id) ++ "/attach_images"),
+ "courses/" ++ ((course->Course.id) ++ "/attach_images"),
DomUtils.FormData.create(element),
json => {
Notification.success("Done!", "Images have been updated successfully.")
@@ -77,18 +77,18 @@ let optionalImageLabelText = (image, selectedFilename) =>
switch selectedFilename {
| Some(name) =>
- {"You have selected " |> str}
- {name |> str}
- {". Click to replace the current image." |> str}
+ {"You have selected "->str}
+ {name->str}
+ {". Click to replace the current image."->str}
| None =>
switch image {
| Some(existingImage) =>
- {"Please pick a file to replace " |> str}
- {existingImage |> Course.filename |> str}
+ {"Please pick a file to replace "->str}
+ {existingImage->Course.filename->str}
- | None => "Please choose an image file." |> str
+ | None => "Please choose an image file."->str
}
}
@@ -105,8 +105,8 @@ let isInvalidImageFile = image =>
let updateImage = (send, isCover, event) => {
let imageFile = ReactEvent.Form.target(event)["files"][0]
isCover
- ? send(SelectCover(imageFile["name"], imageFile |> isInvalidImageFile))
- : send(SelectThumb(imageFile["name"], imageFile |> isInvalidImageFile))
+ ? send(SelectCover(imageFile["name"], imageFile->isInvalidImageFile))
+ : send(SelectThumb(imageFile["name"], imageFile->isInvalidImageFile))
}
let initialState = () => {
@@ -141,8 +141,8 @@ let reducer = (state, action) =>
let make = (~course, ~updateCourseCB, ~closeDrawerCB) => {
let (state, send) = React.useReducer(reducer, initialState())
- let thumbnail = course |> Course.thumbnail
- let cover = course |> Course.cover
+ let thumbnail = course->Course.thumbnail
+ let cover = course->Course.cover