mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 04:54:13 +02:00
Add wiring_list_view: from-to wiring list over the conductor tables
Slice 3 of discussion #503, on top of slice 2 (#628). One row per conductor, each endpoint resolved to its element label and terminal name -- the `F1:4 -> M200:U1` shape from the original prototype. The view deviates from the SQL sketched in the discussion in two ways, both because the sketched version silently loses wires: - **No join to the `element` table.** A terminal row already carries its `element_uuid`, so joining `element` back just to read the same uuid adds nothing. Worse, it filters: `populateElementTable()` only inserts elements matching `Simple|Terminal|Master|Thumbnail`, so `Slave` elements (relay contacts and the like -- extremely common at the end of a wire) and report elements are simply absent from that table after a project load, and an inner join through it drops their conductors. - **`element_info` is LEFT joined** for the same reason. A wire whose endpoint element has no info row still belongs in a wiring list; it comes back with an empty label rather than vanishing. Losing a wire from a wiring list is a worse failure than showing one with a blank end. Note this only bites after a save/reload. The incremental `addElement()` path does not apply the type filter, so a slave element placed live is present in `element`/`element_info` and an inner join looks fine -- it is the bulk repopulate on project load that drops it. Testing only the live-editing path would have missed this entirely. Measured, comparing this view against an inner-join-through-element variant built from the same tables in the same session: | project | conductors | wiring_list_view | inner-join variant | |---|---|---|---| | Polonez MR'89 wiring diagram | 280 | 280 | 280 | | two slave contacts, after save+reload | 1 | **1** | **0** | Polonez happens to have no slave elements at conductor ends, so both agree there and the problem is invisible. The second case is the minimal reproduction: place two "Simple contact" elements (`link_type="slave"`) so autoconnect wires them, save, reload -- the sketched view returns zero rows for a project that plainly has a wire in it. Acceptance criterion held throughout: `wiring_list_view` row count equals `conductor` row count, i.e. the view itself drops nothing. Conductors already excluded upstream (legacy terminals without uuids, see #628) stay excluded; that remains the only thing missing from the list, and is what slice 4 should surface a count for.
This commit is contained in:
@@ -77,6 +77,7 @@ class projectDataBase : public QObject
|
||||
bool createDataBase();
|
||||
void createElementNomenclatureView();
|
||||
void createSummaryView();
|
||||
void createWiringListView();
|
||||
void populateDiagramTable();
|
||||
void populateElementTable();
|
||||
void populateElementInfoTable();
|
||||
|
||||
Reference in New Issue
Block a user