USACE / USACE/cwms-data-api

Update UnitDao to retrieve info in one call and resolve a bug that Peter identified

Open
#812 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.