ComPlat / chemotion_ELN

Electronic Lab Notebook
https://www.chemotion.net
GNU Affero General Public License v3.0
119 stars 45 forks source link

feat: Allow comma and period as decimal separators in reaction variations table #1959

Closed JanCBrammer closed 1 week ago

JanCBrammer commented 4 weeks ago

This PR addresses #1948.

The reaction variations table accepts only a period (i.e., ".") as decimal separator for numeric entries. The goal is to allow a comma and period as decimal separators. In the current codebase, there are at least two ways to achieve this.

1. Using the JavaScript package numeral

The package is used in the NumeralInput component (which in turn is used in "Elemental composition" section of SampleDetails component via ElementalCompositionCustom and ElementalCompositionGroupcomponents). I decided not to use numeral:

2. Custom logic in the handleInputValueChange method of the NumeralInputWithUnitsCompo component

I decided against using the custom logic:

Since the JavaScript standard library doesn't offer locale-specific number parsing / parsing different decimal separators (see https://stackoverflow.com/a/42000120 and https://stackoverflow.com/questions/55364947/is-there-any-javascript-standard-api-to-parse-to-number-according-to-locale), I'm adding a dependency-free solution that could ideally be re-used to replace solutions 1. and 2. (in a separate PR).

github-actions[bot] commented 4 weeks ago

LCOV of commit b79d535 during Continuous Integration #2916

Summary coverage rate:
  lines......: 64.1% (13672 of 21316 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a
github-actions[bot] commented 3 weeks ago

LCOV of commit 59e2d74 during Continuous Integration #2967

Summary coverage rate:
  lines......: 64.1% (13672 of 21316 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a
github-actions[bot] commented 2 weeks ago

LCOV of commit 0665a60 during Continuous Integration #2971

Summary coverage rate:
  lines......: 64.1% (13672 of 21316 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a