Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wandelwerk-Software
libraries
components
Commits
739cf70b
Commit
739cf70b
authored
Sep 16, 2020
by
Bruno Burke
😁
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'converge-calculation-and-multistep-calculation-exercise' into develop
parents
a7ade4de
41a8aac5
Pipeline
#47836
passed with stages
in 2 minutes and 19 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
55 deletions
+61
-55
project.clj
project.clj
+1
-1
src/cljs/lernmeister/components/common.cljs
src/cljs/lernmeister/components/common.cljs
+3
-3
src/cljs/lernmeister/components/exercise_types/calculation/views/edit.cljs
...ter/components/exercise_types/calculation/views/edit.cljs
+11
-10
src/cljs/lernmeister/components/exercise_types/calculation/views/show.cljs
...ter/components/exercise_types/calculation/views/show.cljs
+21
-18
src/cljs/lernmeister/components/exercise_types/multistep_calculation/views/edit.cljs
...ents/exercise_types/multistep_calculation/views/edit.cljs
+9
-9
src/cljs/lernmeister/components/exercise_types/multistep_calculation/views/show.cljs
...ents/exercise_types/multistep_calculation/views/show.cljs
+16
-14
No files found.
project.clj
View file @
739cf70b
(
defproject
lernmeister.components
"1.0.0.
6
-dev"
(
defproject
lernmeister.components
"1.0.0.
7
-dev"
:repositories
[[
"internal"
{
:url
"https://lernmeister.fh-muenster.de:8082/artifactory/libs-release"
:username
"anonymous"
}]]
:dependencies
[[
org.clojure/clojure
"1.10.0"
]
...
...
src/cljs/lernmeister/components/common.cljs
View file @
739cf70b
...
...
@@ -35,7 +35,7 @@
(
defn
correct-tick-fa
[]
[
:span.icon.has-background-white.has-text-success
[
:i.fa
r
.fa-check-square
]])
[
:i.fa
s
.fa-check-square
]])
(
defn
neutral-tick
[]
(
fn
[]
...
...
@@ -43,7 +43,7 @@
(
defn
neutral-tick-fa
[]
[
:span.icon.has-background-white.has-text-info
[
:i.fa
r
.fa-meh
]])
[
:i.fa
s
.fa-meh
]])
(
defn
wrong-tick
[]
(
fn
[]
...
...
@@ -51,7 +51,7 @@
(
defn
wrong-tick-fa
[]
[
:span.icon.has-background-white.has-text-danger
[
:i.fa
r
.fa-times-circle
]])
[
:i.fa
s
.fa-times-circle
]])
(
defn
binary-input
[{
:keys
[
default-bits
result
on-change-fn
bitcount
]
:or
{
bitcount
8
}}]
...
...
src/cljs/lernmeister/components/exercise_types/calculation/views/edit.cljs
View file @
739cf70b
...
...
@@ -26,8 +26,6 @@
[
clj-helper.vector
:as
vhelper
]
[
reagent.core
:as
reagent
]))
(
def
modal-state-atom
(
reagent/atom
{}))
(
defn
get-new-calculation
[
with-units
]
(
let
[
base-object
{
:id
(
get-unique-id
"ae"
)
:name
nil
...
...
@@ -54,7 +52,7 @@
:correct
int-part
:incorrect
(
str
"-"
int-part
))))))
(
defn
show-calculation
[{
:keys
[
exercise-core
index
calculation
change-fn
delete-fn
]}]
(
defn
show-calculation
[{
:keys
[
exercise-core
index
calculation
change-fn
delete-fn
modal-state-atom
]}]
(
let
[
calculations
(
:calculations
exercise-core
)
base-path
[
:core
:calculations
index
]
answer
(
into
{}
...
...
@@ -104,7 +102,7 @@
:do-render
true
:modal-state-atom
modal-state-atom
}]]]]))
(
defn
new-exercise-form
[{
:keys
[
exercise-atom
change-fn
]}]
(
defn
new-exercise-form
[{
:keys
[
exercise-atom
change-fn
modal-state-atom
]}]
(
let
[
exercise
@
exercise-atom
exercise-core
(
:core
exercise
)
with-units
(
:with-units
exercise-core
)
...
...
@@ -130,7 +128,8 @@
:index
index
:calculation
calculation
:change-fn
change-fn
:delete-fn
#
(
change-fn
[
:core
:calculations
]
(
vec-remove
calculations
%
))}])
:delete-fn
#
(
change-fn
[
:core
:calculations
]
(
vec-remove
calculations
%
))
:modal-state-atom
modal-state-atom
}])
calculations
)]]
[
ui/modal-panel
{
:state
(
reagent/cursor
modal-state-atom
[
:modal-visible?
])
...
...
@@ -234,11 +233,13 @@
exercise-scheme-version
)))))}))
(
defn
additional-forms
[
exercise-atom
]
(
when
(
=
:current
(
get-in
@
exercise-atom
[
:authoring
:migration-status
]))
[
new-exercise-form
{
:exercise-atom
exercise-atom
:change-fn
(
partial
calc-change-fn
(
fn
[
exercise
]
(
reset!
exercise-atom
exercise
))
@
exercise-atom
)}]))
(
reagent/with-let
[
modal-state-atom
(
reagent/atom
{})]
(
when
(
=
:current
(
get-in
@
exercise-atom
[
:authoring
:migration-status
]))
[
new-exercise-form
{
:exercise-atom
exercise-atom
:change-fn
(
partial
calc-change-fn
(
fn
[
exercise
]
(
reset!
exercise-atom
exercise
))
@
exercise-atom
)
:modal-state-atom
modal-state-atom
}])))
(
defmethod
e-edit/show-settings
:calculation
[
_
_
]
(
fn
[
exercise-atom
_
]
...
...
src/cljs/lernmeister/components/exercise_types/calculation/views/show.cljs
View file @
739cf70b
...
...
@@ -13,10 +13,12 @@
[
lernmeister.components.exercise-types.calchelper
:refer
[
build-latex-string
calc-change-fn
]]
[
lernmeister.components.exercise-types.calculation.check
:refer
[
get-calculation-ids
]]
[
lernmeister.components.exercise-types.calculation.migrate-answer
:refer
[
answer-scheme-version
migrate-answer
]]
[
lernmeister.components.exercise-types.calculation.check
:refer
[
get-calculation-ids
]]
[
lernmeister.components.exercise-types.multistep-calculation.check
:refer
[
number-obj
]]
...
...
@@ -31,8 +33,6 @@
[
lernmeister.components.ui
:as
ui
]
[
reagent.core
:as
reagent
]))
(
def
modal-state-atom
(
reagent/atom
{}))
(
defn
get-new-calculation
[
with-units
]
(
let
[
base-object
{
:number
number-obj
}]
(
if
with-units
(
assoc
base-object
:units
[])
...
...
@@ -99,7 +99,7 @@
[
:span.icon
[
:i.fas.fa-edit
]]
[
:span
"Einheit"
]]])]])]]))
(
defn
calculations
[{
:keys
[
exercise-core
result
answer
change-fn
]}]
(
defn
calculations
[{
:keys
[
exercise-core
result
answer
change-fn
modal-state-atom
]}]
(
let
[
calculations
(
:calculations
exercise-core
)]
(
if
(
pos?
(
count
calculations
))
[
:<>
...
...
@@ -117,7 +117,7 @@
calculations
)]
[
:span
"No calculations available"
])))
(
defn
print-calculation-exercise
[{
:keys
[
answer
exercise
change-fn
result
options
]}]
(
defn
print-calculation-exercise
[{
:keys
[
answer
exercise
change-fn
result
modal-state-atom
options
]}]
[
:<>
[
ui/card
{
:title
(
str
(
:title
exercise
))}
...
...
@@ -127,7 +127,8 @@
[
calculations
{
:exercise-core
(
:core
exercise
)
:result
result
:answer
answer
:change-fn
change-fn
}]
:change-fn
change-fn
:modal-state-atom
modal-state-atom
}]
(
when
result
[
:div.has-text-right
{
:class
(
get-result-color-class
result
)}
[
point-result
{
:result
result
}]])]]
...
...
@@ -157,18 +158,20 @@
:used-units
selectable-units
}])]]])
(
defn
exercise-renderer
[
exercise
{
:keys
[
result
answer
on-change
]}]
(
let
[
calculation-ids
(
get-calculation-ids
exercise
)
ans-obj
(
or
answer
(
fresh-answer-obj
calculation-ids
(
get-in
exercise
[
:core
:with-units
])))
options
(
ce-core/receive-options
(
:core
exercise
))]
(
if-let
[
migrated-answer
(
migrate-if-necessary
ans-obj
:answer-scheme
"calculation"
answer-scheme-version
(
partial
migrate-answer
calculation-ids
))]
[
print-calculation-exercise
{
:answer
migrated-answer
:exercise
exercise
:change-fn
(
partial
calc-change-fn
on-change
migrated-answer
)
:result
result
:options
options
}]
[
unmigrateable-answer
])))
(
reagent/with-let
[
modal-state-atom
(
reagent/atom
{})]
(
let
[
calculation-ids
(
get-calculation-ids
exercise
)
ans-obj
(
or
answer
(
fresh-answer-obj
calculation-ids
(
get-in
exercise
[
:core
:with-units
])))
options
(
ce-core/receive-options
(
:core
exercise
))]
(
if-let
[
migrated-answer
(
migrate-if-necessary
ans-obj
:answer-scheme
"calculation"
answer-scheme-version
(
partial
migrate-answer
calculation-ids
))]
[
print-calculation-exercise
{
:answer
migrated-answer
:exercise
exercise
:change-fn
(
partial
calc-change-fn
on-change
migrated-answer
)
:result
result
:options
options
:modal-state-atom
modal-state-atom
}]
[
unmigrateable-answer
]))))
(
defmethod
ce-ex/render-exercise
:calculation
[
_
_
]
(
fn
[
exercise
data
]
...
...
src/cljs/lernmeister/components/exercise_types/multistep_calculation/views/edit.cljs
View file @
739cf70b
...
...
@@ -37,8 +37,6 @@
[
lernmeister.components.ui
:as
ui
]
[
reagent.core
:as
reagent
]))
(
def
modal-state-atom
(
reagent/atom
{}))
(
defn
sort-names-mapping
[
names-map
]
(
sort-by
#
(
:name-text
%
)
(
into
[]
(
map
(
fn
[
item
]
...
...
@@ -67,7 +65,7 @@
:change-fn
change-fn
}]))
names-mapping
)]])
(
defn
new-exercise-form
[{
:keys
[
exercise-atom
change-fn
phrase-fn
]}]
(
defn
new-exercise-form
[{
:keys
[
exercise-atom
change-fn
phrase-fn
modal-state-atom
]}]
(
let
[
exercise
@
exercise-atom
exercise-core
(
:core
exercise
)
with-oom
(
get-in
exercise
[
:core
:with-oom
])
...
...
@@ -245,12 +243,14 @@
exercise-scheme-version
)))))}))
(
defn
additional-forms
[
exercise-atom
]
(
when
(
=
:current
(
get-in
@
exercise-atom
[
:authoring
:migration-status
]))
[
new-exercise-form
{
:exercise-atom
exercise-atom
:change-fn
(
partial
calc-change-fn
(
fn
[
exercise
]
(
reset!
exercise-atom
exercise
))
@
exercise-atom
)
:phrase-fn
(
partial
get-phrase
@
exercise-atom
[
:core
:phrasing
]
names-map
)}]))
(
reagent/with-let
[
modal-state-atom
(
reagent/atom
{})]
(
when
(
=
:current
(
get-in
@
exercise-atom
[
:authoring
:migration-status
]))
[
new-exercise-form
{
:exercise-atom
exercise-atom
:change-fn
(
partial
calc-change-fn
(
fn
[
exercise
]
(
reset!
exercise-atom
exercise
))
@
exercise-atom
)
:phrase-fn
(
partial
get-phrase
@
exercise-atom
[
:core
:phrasing
]
names-map
)
:modal-state-atom
modal-state-atom
}])))
(
defmethod
e-edit/show-settings
:multistep-calculation
[
exercise-atom
options
]
(
fn
[
exercise-atom
options
]
...
...
src/cljs/lernmeister/components/exercise_types/multistep_calculation/views/show.cljs
View file @
739cf70b
...
...
@@ -36,8 +36,6 @@
(
def
selectable-units
(
reagent/atom
{}))
(
def
modal-state-atom
(
reagent/atom
{}))
(
defn
b-crumb-step
[{
:keys
[
position
current-position
phrase-fn
on-click-fn
]}]
[
:<>
[
:li
{
:class
(
when
(
=
position
current-position
)
"is-active"
)}
...
...
@@ -109,7 +107,7 @@
[
:p
"-"
])))
(
defn
multistep-calculation-answer-form
[{
:keys
[
answer
exercise-core
change-fn
phrase-fn
current-position
result
]}]
result
modal-state-atom
]}]
(
let
[
path
(
:path
@
modal-state-atom
)
description-ids
(
:description-ids
exercise-core
)
steps
(
:steps
answer
)
...
...
@@ -208,7 +206,8 @@
[
result-view
{
:step-result
(
:step-result
@
modal-state-atom
)
:assignment-type
(
:assignment-type
@
modal-state-atom
)}])]]]))
(
defn
print-multistep-calculation-exercise
[{
:keys
[
answer
exercise
change-fn
phrase-fn
result
]}]
(
defn
print-multistep-calculation-exercise
[{
:keys
[
answer
exercise
change-fn
phrase-fn
result
modal-state-atom
]}]
(
reagent/with-let
[
current-position
(
reagent/atom
:task
)]
(
let
[
exercise-core
(
:core
exercise
)
positions
(
as->
[
:task
]
v
...
...
@@ -233,7 +232,8 @@
:change-fn
change-fn
:phrase-fn
phrase-fn
:current-position
@
current-position
:result
result
}]]]
:result
result
:modal-state-atom
modal-state-atom
}]]]
(
if
result
[
:span.is-pulled-right
[
point-result
{
:result
result
}]]
(
when-not
(
=
@
current-position
:steps
)
...
...
@@ -243,15 +243,17 @@
:on-click-fn
#
(
reset!
current-position
%
)}]))]])))
(
defn
exercise-renderer
[
exercise
{
:keys
[
result
answer
on-change
]}]
(
if-let
[
migrated-answer
(
migrate-if-necessary
answer
:answer-scheme
"multistep-calculation"
answer-scheme-version
migrate-answer
)]
[
print-multistep-calculation-exercise
{
:answer
migrated-answer
:exercise
exercise
:change-fn
(
partial
calc-change-fn
on-change
migrated-answer
)
:phrase-fn
(
partial
get-phrase
exercise
[
:core
:phrasing
]
names-map
)
:result
result
}]
[
unmigrateable-answer
]))
(
reagent/with-let
[
modal-state-atom
(
reagent/atom
{})]
(
if-let
[
migrated-answer
(
migrate-if-necessary
answer
:answer-scheme
"multistep-calculation"
answer-scheme-version
migrate-answer
)]
[
print-multistep-calculation-exercise
{
:answer
migrated-answer
:exercise
exercise
:change-fn
(
partial
calc-change-fn
on-change
migrated-answer
)
:phrase-fn
(
partial
get-phrase
exercise
[
:core
:phrasing
]
names-map
)
:result
result
:modal-state-atom
modal-state-atom
}]
[
unmigrateable-answer
])))
(
defmethod
ce-ex/render-exercise
:multistep-calculation
[
_
_
]
(
fn
[
exercise
data
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment