Compare commits
2 Commits
38ef683b69
...
feature/qu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24cce8ea71 | ||
|
|
b7177c455e |
@@ -9,7 +9,11 @@ on:
|
|||||||
# Pinned so every run targets the same project regardless of the runner's
|
# Pinned so every run targets the same project regardless of the runner's
|
||||||
# checkout path — otherwise `docker compose` would derive the project name
|
# checkout path — otherwise `docker compose` would derive the project name
|
||||||
# from the checkout directory, potentially spinning up a second stack and
|
# from the checkout directory, potentially spinning up a second stack and
|
||||||
# losing the `pgdata` volume instead of updating the running one.
|
# losing the `pgdata` volume instead of updating the running one. Must be
|
||||||
|
# `ruvdstest` (no trailing "s") to match the project name the live stack was
|
||||||
|
# actually deployed under — a one-letter mismatch here previously made
|
||||||
|
# Compose treat it as an unrelated project and spin up a whole second stack
|
||||||
|
# from scratch instead of recognizing and updating the running containers.
|
||||||
#
|
#
|
||||||
# JWT_SECRET/POSTGRES_PASSWORD come from Gitea's own Actions secrets store
|
# JWT_SECRET/POSTGRES_PASSWORD come from Gitea's own Actions secrets store
|
||||||
# rather than the `.env` file DEPLOY.md has the human create in
|
# rather than the `.env` file DEPLOY.md has the human create in
|
||||||
@@ -20,7 +24,7 @@ on:
|
|||||||
# COMPOSE_PROJECT_NAME above), and a different POSTGRES_PASSWORD than what
|
# COMPOSE_PROJECT_NAME above), and a different POSTGRES_PASSWORD than what
|
||||||
# the live `pgdata` volume was initialized with breaks the DB connection.
|
# the live `pgdata` volume was initialized with breaks the DB connection.
|
||||||
env:
|
env:
|
||||||
COMPOSE_PROJECT_NAME: ruvdstests
|
COMPOSE_PROJECT_NAME: ruvdstest
|
||||||
JWT_SECRET: ${{ secrets.JWT_SECRET }}
|
JWT_SECRET: ${{ secrets.JWT_SECRET }}
|
||||||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,25 @@ let private kindLabel (t: QuestionTypeView) =
|
|||||||
| ShortAnswerT _ -> "Короткий ответ"
|
| ShortAnswerT _ -> "Короткий ответ"
|
||||||
| NumericT _ -> "Числовой"
|
| NumericT _ -> "Числовой"
|
||||||
|
|
||||||
|
/// Read-only rendering of a question's correct answer(s) for the teacher's
|
||||||
|
/// question-bank table — distinct from `formFromSummary` in Types.fs, which
|
||||||
|
/// unpacks the same data to prefill the edit form instead of displaying it.
|
||||||
|
let private correctAnswerText (t: QuestionTypeView) =
|
||||||
|
match t with
|
||||||
|
| SingleChoiceT d ->
|
||||||
|
d.Options
|
||||||
|
|> List.tryFind (fun o -> o.Id = d.CorrectOptionId)
|
||||||
|
|> Option.map (fun o -> o.Text)
|
||||||
|
|> Option.defaultValue "—"
|
||||||
|
| MultipleChoiceT d ->
|
||||||
|
d.Options
|
||||||
|
|> List.filter (fun o -> List.contains o.Id d.CorrectOptionIds)
|
||||||
|
|> List.map (fun o -> o.Text)
|
||||||
|
|> String.concat ", "
|
||||||
|
| TrueFalseT b -> if b then "Верно" else "Неверно"
|
||||||
|
| ShortAnswerT d -> String.concat ", " d.AcceptedAnswers
|
||||||
|
| NumericT d -> sprintf "%s ± %s" (Format.points d.CorrectValue) (Format.points d.Tolerance)
|
||||||
|
|
||||||
let private questionsListView (model: Model) dispatch =
|
let private questionsListView (model: Model) dispatch =
|
||||||
Html.div [
|
Html.div [
|
||||||
prop.className "questions-list"
|
prop.className "questions-list"
|
||||||
@@ -78,18 +97,30 @@ let private questionsListView (model: Model) dispatch =
|
|||||||
elif model.Questions.IsEmpty then
|
elif model.Questions.IsEmpty then
|
||||||
Html.p "В этой теме пока нет вопросов"
|
Html.p "В этой теме пока нет вопросов"
|
||||||
else
|
else
|
||||||
Html.ul [
|
Html.table [
|
||||||
|
prop.className "questions-table"
|
||||||
prop.children [
|
prop.children [
|
||||||
|
Html.thead [
|
||||||
|
Html.tr [
|
||||||
|
Html.th [ prop.text "Текст вопроса" ]
|
||||||
|
Html.th [ prop.text "Тип" ]
|
||||||
|
Html.th [ prop.text "Правильный ответ" ]
|
||||||
|
Html.th [ prop.text "Баллы" ]
|
||||||
|
Html.th []
|
||||||
|
]
|
||||||
|
]
|
||||||
|
Html.tbody [
|
||||||
for q in model.Questions ->
|
for q in model.Questions ->
|
||||||
Html.li [
|
Html.tr [
|
||||||
prop.key (string q.Id)
|
prop.key (string q.Id)
|
||||||
prop.children [
|
prop.children [
|
||||||
Html.span [ prop.className "question-kind"; prop.text (kindLabel q.Type) ]
|
Html.td [ prop.text q.Text ]
|
||||||
Html.text (sprintf " %s " q.Text)
|
Html.td [ prop.className "question-kind"; prop.text (kindLabel q.Type) ]
|
||||||
Html.span [
|
Html.td [ prop.text (correctAnswerText q.Type) ]
|
||||||
prop.className "tag-mono"
|
Html.td [ prop.className "tag-mono"; prop.text (Format.points q.Points) ]
|
||||||
prop.text (sprintf "%s б." (Format.points q.Points))
|
Html.td [
|
||||||
]
|
prop.className "question-actions-cell"
|
||||||
|
prop.children [
|
||||||
Html.button [
|
Html.button [
|
||||||
prop.type'.button
|
prop.type'.button
|
||||||
prop.onClick (fun _ -> dispatch (StartEditQuestion q.Id))
|
prop.onClick (fun _ -> dispatch (StartEditQuestion q.Id))
|
||||||
@@ -106,6 +137,9 @@ let private questionsListView (model: Model) dispatch =
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
let private optionsEditor (form: NewQuestionForm) dispatch (multi: bool) =
|
let private optionsEditor (form: NewQuestionForm) dispatch (multi: bool) =
|
||||||
Html.div [
|
Html.div [
|
||||||
|
|||||||
@@ -681,17 +681,44 @@ a {
|
|||||||
margin-bottom: 1.25rem;
|
margin-bottom: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.questions-list li {
|
.questions-table {
|
||||||
display: flex;
|
width: 100%;
|
||||||
flex-wrap: wrap;
|
border-collapse: collapse;
|
||||||
align-items: center;
|
font-size: 0.9rem;
|
||||||
gap: 0.5rem;
|
|
||||||
border-top: 1px solid var(--line);
|
|
||||||
padding: 0.6rem 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.questions-list li:first-child {
|
.questions-table th,
|
||||||
border-top: none;
|
.questions-table td {
|
||||||
|
text-align: left;
|
||||||
|
padding: 0.55rem 0.75rem;
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.questions-table th {
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--ink-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.questions-table tbody tr:hover {
|
||||||
|
background: var(--brass-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* `width: 1%` shrinks this column to just its buttons' content width —
|
||||||
|
since it's the only unconstrained column left, the question-text column
|
||||||
|
absorbs 100% of the remaining space instead, so the buttons stay pinned
|
||||||
|
flush right regardless of how long any question's text is. */
|
||||||
|
.question-actions-cell {
|
||||||
|
white-space: nowrap;
|
||||||
|
width: 1%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.question-actions-cell button {
|
||||||
|
margin-left: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.question-kind {
|
.question-kind {
|
||||||
@@ -700,7 +727,6 @@ a {
|
|||||||
color: var(--brass);
|
color: var(--brass);
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.03em;
|
letter-spacing: 0.03em;
|
||||||
margin-right: 0.5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.new-question-form {
|
.new-question-form {
|
||||||
|
|||||||
Reference in New Issue
Block a user