Update UnitDao to retrieve info in one call and resolve a bug that Peter identified
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 28
- Forks
- 25
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 20
Description
In reference to #498, a bug was identified in Peter's review of other parts of the code, and found that the query needs to be adjusted to do one call and correctly provide the base unit, and its aliases. The view picks up the aliases, so it was returning a series of duplicate entries for different aliases.
select cu.unit_id, cu.long_name, cu.unit_system, cu.description, cap.abstract_param_id, atu.alias_id
from cwms_20.cwms_unit cu
inner join cwms_20.at_unit_alias atu on (cu.unit_code = atu.unit_code and (db_office_code = 53 /or db_office_code = SWT/))
inner join cwms_20.cwms_abstract_parameter cap on (cu.abstract_param_code = cap.abstract_param_code)
Originally posted by @rma-psmorris in https://github.com/USACE/cwms-data-api/pull/718#discussion_r1687230205
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate UnitDao and inspect the query and the view that consumes its aliases. Review the context in #498 and the linked PR #718 discussion, then verify that one retrieval provides the base unit and aliases without duplicate entries.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100