-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: [AXIMST-93, 99, 105, 518, 537] Group configuration - Experiment Groups #188
feat: [AXIMST-93, 99, 105, 518, 537] Group configuration - Experiment Groups #188
Conversation
4ea5971
to
a1500ed
Compare
a1500ed
to
a162c3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ruzniaievdm The feature with percentage looks pretty cool!!!
I have a couple of suggestions:
- Should the font size of error text be the same?
- In the current implementation, the user can create a group with an empty value (if you add spaces instead of text, the groups can be saved)
src/group-configurations/experiment-configurations-section/ExperimentForm.jsx
Outdated
Show resolved
Hide resolved
src/group-configurations/experiment-configurations-section/ExperimentFormGroups.jsx
Show resolved
Hide resolved
src/group-configurations/experiment-configurations-section/utils.js
Outdated
Show resolved
Hide resolved
}, | ||
subtitleModalDelete: { | ||
id: 'course-authoring.group-configurations.container.delete-modal.subtitle', | ||
defaultMessage: 'content group', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] should be lowercase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we should it used like changing variable for sentence
src/group-configurations/data/api.js
Outdated
} | ||
|
||
/** | ||
* Delete exists experimental configuration from the course. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Delete exists experimental configuration from the course. | |
* Delete existing experimental configuration from the course. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
* @param {object} configuration | ||
* @returns {Promise<Object>} | ||
*/ | ||
export async function createExperimentConfiguration(courseId, configuration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[question] Do we delete configuration or group? In case if we delete a group it requires renaming to createExperimentGroup
. For other functions the same question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We remove exactly configuration.
There are types content group, experiment configuration with actions.
That's what I called such them
configuration: experimentConfigurationUpdated, | ||
}); | ||
|
||
const cardTitle = getByTestId('configuration-card-header__button'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] I think this double underscore here is not needed. Let's refactor a bit.
const cardTitle = getByTestId('configuration-card-header__button'); | |
const cardTitle = getByTestId('configuration-card-header-button'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
{groups.map((item) => ( | ||
<div | ||
className="configuration-card-content__experiment-stack" | ||
data-testid="configuration-card-content__experiment-stack" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data-testid="configuration-card-content__experiment-stack" | |
data-testid="configuration-card-content-experiment-stack" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
values, errors, dirty, handleChange, handleSubmit, | ||
}) => ( | ||
<> | ||
<Form.Group className="mt-3 form-group-configuration" isInvalid={!!errors.name}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<Form.Group className="mt-3 form-group-configuration" isInvalid={!!errors.name}> | |
<Form.Group className="mt-3 configuration-form-group" isInvalid={!!errors.name}> |
To stick to the pattern above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
|
||
return ( | ||
<Form.Group | ||
key={idx} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key={idx} | |
key={group.name} |
will it be unique or maybe group.id
? If you change here you can remove eslint-disable
on top of the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const initialExperimentConfiguration = {
name: '',
description: '',
groups: [
{ name: 'Group A', version: 1, usage: [] },
{ name: 'Group B', version: 1, usage: [] },
],
scheme: 'random',
parameters: {},
usage: [],
active: true,
version: 1,
};
This component handle each group item, so we don't always have id
field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it is initial groups without preinstalled id
value
const getNextGroupName = (groups, groupFieldName = 'name') => { | ||
const existingGroupNames = groups.map((group) => group.name); | ||
|
||
let nextIndex = existingGroupNames.length + 1; | ||
|
||
let groupName = ''; | ||
while (nextIndex > 0) { | ||
groupName = ALPHABET_LETTERS[(nextIndex - 1) % 26] + groupName; | ||
nextIndex = Math.floor((nextIndex - 1) / 26); | ||
} | ||
|
||
let counter = 0; | ||
let newName = groupName; | ||
while (existingGroupNames.includes(`Group ${newName}`)) { | ||
counter++; | ||
let newIndex = existingGroupNames.length + 1 + counter; | ||
groupName = ''; | ||
while (newIndex > 0) { | ||
groupName = ALPHABET_LETTERS[(newIndex - 1) % 26] + groupName; | ||
newIndex = Math.floor((newIndex - 1) / 26); | ||
} | ||
newName = groupName; | ||
} | ||
return { [groupFieldName]: `Group ${newName}`, version: 1, usage: [] }; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const getNextGroupName = (groups, groupFieldName = 'name') => { | |
const existingGroupNames = groups.map((group) => group.name); | |
let nextIndex = existingGroupNames.length + 1; | |
let groupName = ''; | |
while (nextIndex > 0) { | |
groupName = ALPHABET_LETTERS[(nextIndex - 1) % 26] + groupName; | |
nextIndex = Math.floor((nextIndex - 1) / 26); | |
} | |
let counter = 0; | |
let newName = groupName; | |
while (existingGroupNames.includes(`Group ${newName}`)) { | |
counter++; | |
let newIndex = existingGroupNames.length + 1 + counter; | |
groupName = ''; | |
while (newIndex > 0) { | |
groupName = ALPHABET_LETTERS[(newIndex - 1) % 26] + groupName; | |
newIndex = Math.floor((newIndex - 1) / 26); | |
} | |
newName = groupName; | |
} | |
return { [groupFieldName]: `Group ${newName}`, version: 1, usage: [] }; | |
}; | |
const getNextGroupName = (groups, groupFieldName = 'name') => { | |
const existingGroupNames = new Set(groups.map((group) => group[groupFieldName])); | |
let baseName = 'A'; | |
let counter = 1; | |
while (existingGroupNames.has(`Group ${baseName}${counter}`)) { | |
counter++; | |
if (counter > 26) { | |
baseName = String.fromCharCode(baseName.charCodeAt(0) + 1); // Increment base letter | |
counter = 1; | |
} | |
} | |
return { [groupFieldName]: `Group ${baseName}${counter}`, version: 1, usage: [] }; | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add variables where you think is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not what we need to have/
Your solution generates groups in the sequence [A1, A2, A3,..]
* @param {Array} groups - An array of group objects. | ||
* @returns {boolean} True if all group names are unique, otherwise false. | ||
*/ | ||
const allGroupNameAreUnique = (groups) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const allGroupNameAreUnique = (groups) => { | |
const allGroupNamesAreUnique = (groups) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed
* @param {number} totalGroups - Total number of groups. | ||
* @returns {string} The percentage of groups, each group has the same value. | ||
*/ | ||
const getGroupPercentage = (totalGroups) => `${totalGroups === 0 ? 0 : Math.floor(100 / totalGroups)}%`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const getGroupPercentage = (totalGroups) => `${totalGroups === 0 ? 0 : Math.floor(100 / totalGroups)}%`; | |
const getGroupPercentage = (totalGroups) => totalGroups === 0 ? '0%' : `${Math.floor(100 / totalGroups)}%`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed
Good catch for both, thanks! |
@@ -26,7 +26,7 @@ | |||
align-content: center; | |||
justify-content: space-between; | |||
|
|||
.configuration-card-header__button { | |||
.configuration-card-header-button { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously it was OK for class names. Only change for data-test-id
is required to the word-word-word-word
pattern. classNames
should be with double underscores as you had previously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted changed
@@ -10,8 +10,8 @@ const ExperimentCardGroup = ({ groups }) => { | |||
<Stack className="mb-3"> | |||
{groups.map((item) => ( | |||
<div | |||
className="configuration-card-content__experiment-stack" | |||
data-testid="configuration-card-content__experiment-stack" | |||
className="configuration-card-content-experiment-stack" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here also configuration-card-content__experiment-stack
740dc5e
to
05362bb
Compare
… Groups (#188) * feat: [AXIMST-93, 99, 105] Group configuration - Experiment Groups * fix: [AXIMST-518, 537] Group configuration - resolve bugs * fix: review discussions * fix: revert classname case
… Groups (#188) * feat: [AXIMST-93, 99, 105] Group configuration - Experiment Groups * fix: [AXIMST-518, 537] Group configuration - resolve bugs * fix: review discussions * fix: revert classname case
… Groups (#188) * feat: [AXIMST-93, 99, 105] Group configuration - Experiment Groups * fix: [AXIMST-518, 537] Group configuration - resolve bugs * fix: review discussions * fix: revert classname case
… Groups (#188) * feat: [AXIMST-93, 99, 105] Group configuration - Experiment Groups * fix: [AXIMST-518, 537] Group configuration - resolve bugs * fix: review discussions * fix: revert classname case
Add-Experiment-Groups
Delete-Experiment-Group
Edit-Experiment-Group
No-Internet-connection-alert-is-shown-with-incorrect-styles
sidebar-text-isnt-aligned-with-legacy
The main group configuration page
There were added actions to handle group configuration:
Create
Edit
Delete