@01-edu/shared 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/attrs-defs.js CHANGED
@@ -389,7 +389,7 @@ attrs.autoValidateWhere = {
389
389
  const skillsList = {
390
390
  value: {},
391
391
  editable: true,
392
- label: 'Skills',
392
+ label: 'Skills rewarded',
393
393
  type: mapValues(skillsSet, ({ name, type: instruction, description }) => ({
394
394
  label: name,
395
395
  instruction,
@@ -403,7 +403,8 @@ const skillsList = {
403
403
  }
404
404
  const sharedBasedSkills = {
405
405
  ...skillsList,
406
- instruction: 'Expertise(s) that this content is worth.',
406
+ instruction:
407
+ 'Skills rewarded to users when they succeed in the current content',
407
408
  }
408
409
  relationAttrs.baseSkills = {
409
410
  // only if result associated directly to the object
@@ -427,8 +428,9 @@ const sharedBaseXp = {
427
428
  // TODO: we should not manually set base-xp but play with level and difficulty attribute
428
429
  // then this attribute should not be editable
429
430
  editable: true,
430
- label: 'XP',
431
- instruction: 'Expertise(s) that this content is worth.',
431
+ label: 'XP rewards',
432
+ instruction:
433
+ 'How much experience points the user gets by succeeding on this content',
432
434
  ...Functions({ 'by level and difficulty': getBaseXpByLevelAndDifficulty }),
433
435
  check: amount => {
434
436
  if (!Number.isInteger(amount)) throw Error('Must be a whole number')
@@ -2397,7 +2399,7 @@ const contentRequirements = {
2397
2399
  `Invalid objects requirements - no object found for the following relative paths: ${paths}`,
2398
2400
  )
2399
2401
  error.userFeedback =
2400
- 'You have some misconfigured Access conditions, please update them!'
2402
+ 'You have some misconfigured Contents required, please update them!'
2401
2403
  console.error(error.message)
2402
2404
  throw error
2403
2405
  }
@@ -2782,7 +2784,13 @@ types.pathwaysRequirementObjects = {
2782
2784
  const sharedContentRequirementsForMainAttr = TypeObject({
2783
2785
  ...contentRequirements,
2784
2786
  type: {
2785
- skills: { ...skillsList, instruction: 'Expertises required' },
2787
+ skills: {
2788
+ ...skillsList,
2789
+ label: 'Skills required',
2790
+ instruction: 'Necessary skill level to unlock the current content',
2791
+ description:
2792
+ 'Define the skills and tier required to unlock the current content. The skill tracker button opens a modal where you can visualize the contents that reward the selected skill',
2793
+ },
2786
2794
  objects: {
2787
2795
  ...types.sharedObjectList,
2788
2796
  value: (...args) => {
@@ -4140,6 +4148,7 @@ const sharedBranchOptions = {
4140
4148
  description: 'Changing branch can disrupt the piscine timeline.',
4141
4149
  required: true,
4142
4150
  editable: true,
4151
+ hidden: true,
4143
4152
  }
4144
4153
 
4145
4154
  const getBranchOptions = (object, limit = 9) => {
package/attrs.js CHANGED
@@ -349,6 +349,8 @@ const expandAttr = (key, value, defs, object, getUser) => {
349
349
  // by providing a filter function
350
350
  export const partialExpandDynamicAttrs = (object, getUser, filterFn) => {
351
351
  if (!object.children) return (object.children = {})
352
+ if (!Object.keys(object.children).length) return
353
+
352
354
  const defautlAttrs = getDefaultAttrsEntries(object)
353
355
  const filteredDefaultAttrs = defautlAttrs.filter(filterFn)
354
356
 
@@ -382,6 +384,8 @@ export const partialExpandDynamicAttrs = (object, getUser, filterFn) => {
382
384
  // so the result can be recalculated as needed
383
385
  export const expandDynamicAttrs = (object, getUser) => {
384
386
  if (!object.children) return (object.children = {})
387
+ if (!Object.keys(object.children).length) return
388
+
385
389
  const defautlAttrs = getDefaultAttrsEntries(object)
386
390
 
387
391
  processAttributes(defautlAttrs, object, getUser)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@01-edu/shared",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "scripts": {
@@ -244,6 +244,12 @@ export const skillsSet = {
244
244
  },
245
245
  }
246
246
 
247
+ export const skillTiers = [
248
+ { tier: 'Beginner', name: 'Code Explorer', maxValue: 25 },
249
+ { tier: 'Intermediate', name: 'Bug Squasher', maxValue: 50 },
250
+ { tier: 'Advanced', name: 'Script Wizard', maxValue: 75 },
251
+ { tier: 'Master', name: 'Master Hacker', maxValue: 100 },
252
+ ]
247
253
  export const skillTypes = [
248
254
  {
249
255
  type: 'technical',