Git Product home page Git Product logo

Comments (2)

TedmanNguyen avatar TedmanNguyen commented on July 19, 2024 1

Hello @FaithAbiola, our team would like to work on this issue.

Our plan is to make changes to the following 6 files:

Exploration-metadata-modal.component.ts
“core/templates/pages/exploration-editor-page/modal-templates/exploration-metadata-modal.component.ts”
Screenshot 2024-07-16 102204

Settings-tab.component.ts
“core/templates/pages/exploration-editor-page/settings-tab/settings-tab.component.ts”
Screenshot 2024-07-16 103118

Both Settings-tab.component.ts and Exploration-metadata-modal.component.ts contain preexisting logic that removes duplicate tags upon saving the exploration. The updated code will:

  1. Prevent the user from adding duplicates, as well as tags with numbers and special characters, entirely. When the user attempts to do so, the tag is immediately erased so the exploration does not attempt to save the exploration with invalid tags. The code does this by calling an instance to tagRegex and checking the lowercase version of the tag.
  2. Triggers a boolean flag: isTagInvalid, that helps display a front-end hint to inform the user that an invalid tag was entered, and is related to the next two files.

Exploration-metadata-modal.component.html
“core/templates/pages/exploration-editor-page/modal-templates/exploration-metadata-modal.component.html”
Screenshot 2024-07-16 101833

Settings-tab.component.html
“core/templates/pages/exploration-editor-page/settings-tab/settings-tab.component.html”
Screenshot 2024-07-16 104003

Both Settings-tab.component.html and Exploration-metadata-modal.component.html contain preexisting logic that prevents users from adding more than 10 tags. The updated code will:

  1. Provide feedback to the user in the form of a left-aligned mat-hint, by checking tagIsInvalid. The feedback reminds the user to “Use only lowercase letters, spaces, and no duplicate tags” in red, below the text field, like a typical error message.
  2. Right-aligns the mat-hint regarding 10 tags.

Exploration-metadata-modal.component.spec.ts
“core/templates/pages/exploration-editor-page/modal-templates/exploration-metadata-modal.component.spec.ts”
Screenshot 2024-07-16 111355

Settings-tab.component.spec.ts
“core/templates/pages/exploration-editor-page/settings-tab/settings-tab.component.spec.ts”
Screenshot 2024-07-16 104649

Both Settings-tab.component.spec.ts and Exploration-metadata-modal.component.spec.ts contain front-end unit tests. The updated code provides:

  1. A unit test that checks whether a duplicate tag has been saved
  2. A unit test that checks whether a tag with special characters have been saved and a tag with numbers have been saved

Below, I’ve included pictures of the unit-tests successfully failing when commenting out the code in Exploration-metadata-modal.component.ts and Settings-tab.component.ts. The tests were completed by running the frontend tests:

python -m scripts.run_frontend_tests

Failed test in: Exploration-metadata-modal.component.spec.ts
“core/templates/pages/exploration-editor-page/modal-templates/exploration-metadata-modal.component.spec.ts”
Screenshot 2024-07-15 124033

Failed test in: Settings-tab.component.spec.ts
“core/templates/pages/exploration-editor-page/settings-tab/settings-tab.component.spec.ts”
Screenshot 2024-07-15 124006

The attached video demonstrates how invalid tags are immediately removed upon entering. A hint is automatically displayed to provide feedback to the user. This hint will be removed once the user clicks away from the text field, and will reappear as soon as the user enters another invalid tag.

Demo.for.Duplicate.Tags.Issue.mp4


Note: These fixes cause the following front end tests to fail:
Failed test in: Exploration-metadata-modal.component.spec.ts
“core/templates/pages/exploration-editor-page/modal-templates/exploration-metadata-modal.component.spec.ts”
Screenshot 2024-07-17 113348

Failed test in: Settings-tab.component.spec.ts
“core/templates/pages/exploration-editor-page/settings-tab/settings-tab.component.spec.ts”
Screenshot 2024-07-17 113337

The reason these tests fail is that they utilize a hyphen ("tag-one", tag-two", and "tag-three"). Since the functionality is to test multiple tags, we recommend that the tests be rewritten as ("tag one" or "tag_one" or "tagOne").
This is in line with the specifications that users should only use lowercase alphabetical characters, as well as spaces.

I request that you please assign me this issue. Thank you!

from oppia.

cjt101 avatar cjt101 commented on July 19, 2024

I am working on this, along with @sezavala and @TedmanNguyen!

from oppia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.