Skip to content
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

[DataEntryTable] Use current analysis lang with sense glosses #3239

Merged
merged 4 commits into from
Jul 24, 2024

Conversation

imnasnainaec
Copy link
Collaborator

@imnasnainaec imnasnainaec commented Jul 8, 2024

Resolves #3167

Acceptance test:

  • Data Entry:
    • In semantic domain 1, create entry with vernacular form "vern" and gloss "glossA"
  • Project settings:
    • In "Basic Settings" tab, make sure Autocomplete is on
    • In "Languages" tab, add a new analysis language and move it to the top of the list
  • Data Entry:
    • In semantic domain 2, begin adding a new word by typing "vern" in the Vernacular text field
    • Select "vern" from the dropdown options (either by clicking it or pressing enter when it's highlighted)
    • Verify that the "Select and Entry" dialog pops up and that there is a "vern glossA" option
    • Select it (either by clicking it or pressing enter when it's highlighted)
    • Verify that the "Select a Sense" dialog appears and that there is a "glossA" option
    • Select it (either by clicking it or pressing enter when it's highlighted)
    • Verify that the dialog disappears and the Gloss text field now has the text "glossA"
    • Change the gloss text to "glossB" and press Enter
  • Review Entries:
    • Verify that there is a row with "vern" in the Vernacular column and "glossA; glossB" in the Glosses column
    • Edit that row by clicking the pencil icon in the first column
    • Verify that an "Edit : vern" dialog pops up and that in the Senses section there is a single sense with two different glosses ("glossA" in the former analysis language; "glossB" in the latter analysis language)
  • Data Entry:
    • In semantic domain 3, begin adding a new word by typing "vern" in the Vernacular text field
    • Select "vern" from the dropdown options (either by clicking it or pressing enter when it's highlighted)
    • Verify that the "Select and Entry" dialog pops up and that there is a "vern glossB" option
    • Select it (either by clicking it or pressing enter when it's highlighted)
    • Verify that the "Select a Sense" dialog appears and that there is a "glossB" option
    • Select it (either by clicking it or pressing enter when it's highlighted)
    • Verify that the dialog disappears and the Gloss text field now has the text "glossB"
    • Press Enter to submit the word
  • Review Entries:
    • Verify that there is a row with: "vern" in the Vernacular column; "1" in the # column; "glossA; glossB" in the Glosses column; semantic domains 1, 2, and 3 in the Domains column.

This change is Reviewable

Copy link

codecov bot commented Jul 8, 2024

Codecov Report

Attention: Patch coverage is 72.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 74.76%. Comparing base (8975e57) to head (f44256c).
Report is 40 commits behind head on master.

Files with missing lines Patch % Lines
src/components/DataEntry/DataEntryTable/index.tsx 61.11% 4 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3239      +/-   ##
==========================================
- Coverage   74.84%   74.76%   -0.08%     
==========================================
  Files         277      277              
  Lines       10641    10652      +11     
  Branches     1279     1283       +4     
==========================================
  Hits         7964     7964              
- Misses       2314     2321       +7     
- Partials      363      367       +4     
Flag Coverage Δ
backend 83.92% <ø> (-0.13%) ⬇️
frontend 66.69% <72.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@imnasnainaec imnasnainaec changed the title In displaying/updating senses, default to gloss of current analysis lang [DataEntryTable] Use current analysis language in handling senses Jul 8, 2024
@imnasnainaec imnasnainaec changed the title [DataEntryTable] Use current analysis language in handling senses [DataEntryTable] Use current analysis lang in handling sense glosses Jul 8, 2024
@imnasnainaec imnasnainaec changed the title [DataEntryTable] Use current analysis lang in handling sense glosses [DataEntryTable] Use current analysis lang with sense glosses Jul 8, 2024
@imnasnainaec imnasnainaec marked this pull request as ready for review July 8, 2024 21:09
@imnasnainaec imnasnainaec added the enhancement New feature or request label Jul 8, 2024
Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 6 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec)


src/components/DataEntry/DataEntryTable/index.tsx line 164 at r2 (raw file):

  let glossIndex = sense.glosses.findIndex((g) => g.language === analysisLang);
  if (glossIndex === -1) {
    glossIndex = 0;

Should this actually be an error?


src/components/DataEntry/DataEntryTable/tests/index.test.tsx line 263 at r2 (raw file):

      expectedWord.senses[senseIndex] = { ...sense, glosses: [expectedGloss] };

      expect(updateEntryGloss(entry, def, mockSemDom.id, "")).toEqual(

I don't like this being an empty string. There is a code smell here, if we always expect it to be set in the real data having an empty string in the test data feels like a chance for a problem to sneak through in the future.

Code quote:

""

Copy link
Collaborator Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec)


src/components/DataEntry/DataEntryTable/index.tsx line 164 at r2 (raw file):

Previously, jasonleenaylor (Jason Naylor) wrote…

Should this actually be an error?

No, because this parallels how we picked the gloss in the first place. The sense might not have a gloss in the current language, in which case we picked the first gloss. I'll evaluate whether there's a more connected way to do this, or at least add a comment.


src/components/DataEntry/DataEntryTable/tests/index.test.tsx line 263 at r2 (raw file):

Previously, jasonleenaylor (Jason Naylor) wrote…

I don't like this being an empty string. There is a code smell here, if we always expect it to be set in the real data having an empty string in the test data feels like a chance for a problem to sneak through in the future.

Fair. I'll work on it.

Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @imnasnainaec)

@imnasnainaec imnasnainaec merged commit 8be0003 into master Jul 24, 2024
19 checks passed
@imnasnainaec imnasnainaec deleted the new-entry-select-sense branch July 24, 2024 20:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataEntry] Allow adding to existing sense in new langauge
2 participants