oppia: [BUG]: Unable to see added prerequisite skill in skill editor

Describe the bug

Prerequisite skills are not displayed properly in the skill editor after selecting prerequisite skills

Steps To Reproduce

Go to topic and skills dashboard. link

Click on create a new skill button from skill tab.

Try adding prerequisite skill (If no skill exists already, first create a skill.) to the new skill.

After adding the prerequisite skill from the dialog box, see the UI.

EDIT: For new contributors – please see this comment below for more details and explanation.

Expected Behavior

The added prerequisite skill should be clearly visible.

UPDATE (Oct '24) Here is a summary of what needs to be done, based on the discussion below and in #20925:

At least one skill on the test server seems to be merged but not deleted (per this comment). The error might be arising because we aren’t handling deletions of merged skills correctly (see also this comment). We need to do the following (or verify that the following is already happening, e.g. by writing a backend test for it or pointing to an existing one):

Stop the problem from reoccurring, as follows:

  • When deleting skill A, also delete A from each topic’s/skill’s/exploration’s list of prerequisite/acquired/etc. skills.
  • When merging skill A into skill B, make sure to replace A with B (if B isn’t already in the list) for any skills which reference A as a prerequisite. This can be done by doing a datastore query on the prerequisite_skill_ids field when a skill is deleted or merged – i.e. get all SkillModel, TopicModel or ExplorationModel where the prerequisite_skill_ids (or any skill-ID-related) field contains skill ID A, and then do a bulk replacement of A --> B (if B doesn’t already exist in the same field) for the retrieved models.
  • In the frontend, don’t expose skills with a non-null superseding_skill_id in the skill selection popup.
  • For the various objects that use skills (like topics, explorations, etc.), add to the pre-save validation in the backend a check that each skill ID corresponds to a valid skill with an empty superseding_skill_id, and reject the update if it doesn’t (letting the user know which field refers to an invalid skill, and which skill ID that is).

Clean up existing instances of the problem, as follows:

  • Write an Apache Beam job to detect any “dead-link” prerequisites, so that we can fix those issues directly on the servers and make the datastore clean. (We might have no choice but to delete those prerequisites, but let’s at least run an audit job first so that we can figure out the extent of the problem.)
  • Manually delete any skills whose superseding_skill_id that is not null.

Screenshots/Videos

Screenshot from 2023-06-18 23-10-07

Two prerequisite skills where selected. Only one is visible

What device are you using?

Desktop

Operating System

No response

What browsers are you seeing the problem on?

No response

Browser version

No response

Additional context

No response

Tips for developers

Before tackling the bug, please use git bisect (see https://git-scm.com/docs/git-bisect) to investigate which PR caused it (you only need to go back as far as commit https://github.com/oppia/oppia/commits/9a334e9). If you find the PR, leave a comment on this issue pointing to it, or just say that it happened before commit 9a334e9 if you could reproduce it there. This will help us fix the issue by reverting the faulty PR.

Also, if this is your first issue, please make sure to follow https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#choosing-a-good-first-issue and https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#setting-things-up before claiming it. Thanks!

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 41 (18 by maintainers)

Commits related to this issue

Most upvoted comments

@mon4our Thanks for taking a look. Just a note, as a contributor, you can self-assign the issue if you like. I would also suggest that you do the “stop it from happening again” and “clean up existing instances” in separate PRs.

However, there are a few things I spotted that you might want to look at:

  • Frontend code: it’s a bit weird to see things like skill.skill.getId() and skill.skill.getSupersedingSkillId(). I’m wondering if you’re naming things correctly.
  • Backend validate() function – these typically validate only the domain object itself and don’t make any fetches. You will need to do any validation that requires fetching other entities in the services file, since the domain file should not be importing services.

Hm, seems to be working as expected on the test server. image

@Rijuta-s can you please check? I’m removing this from the regressions milestone for now.

Hey @kevintab95 Sorry will be unassigning myself because not able to reproduce on my local machine due to some errors.