clyfe / acts_as_nested_interval Goto Github PK
View Code? Open in Web Editor NEWSaves a tree in a table, fast.
License: MIT License
Saves a tree in a table, fast.
License: MIT License
In some cases lftp and lftq are calculated incorrectly. To reproduce this bug you can do this:
Here's my table dump (postgresql). All values I'v changed to zero manualy. Now when I call Category.rebuild_nested_interval_tree!, lftp, lftq (and lft) are calculated incorrectly.
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
--
-- Name: categories_id_seq; Type: SEQUENCE SET; Schema: public; Owner: ipso-jure
--
SELECT pg_catalog.setval('categories_id_seq', 61, true);
--
-- Data for Name: categories; Type: TABLE DATA; Schema: public; Owner: ipso-jure
--
COPY categories (id, parent_id, lftp, lftq, name, active, lft) FROM stdin;
1 \N 0 0 category 0 t 0
56 40 0 0 category 22 t 0
57 40 0 0 category 23 t 0
58 41 0 0 category 24 t 0
59 58 0 0 category 25 t 0
60 1 0 0 category 26 t 0
5 1 0 0 category 1 t 0
32 1 0 0 category 2 t 0
33 32 0 0 category 3 t 0
37 1 0 0 category 4 t 0
38 1 0 0 category 5 t 0
39 38 0 0 category 6 t 0
40 1 0 0 category 7 t 0
41 1 0 0 category 8 t 0
42 1 0 0 category 9 t 0
43 1 0 0 category 10 t 0
44 1 0 0 category 11 t 0
45 1 0 0 category 12 t 0
46 1 0 0 category 13 t 0
47 1 0 0 category 14 t 0
48 1 0 0 category 15 t 0
49 1 0 0 category 16 t 0
50 49 0 0 category 17 t 0
51 38 0 0 category 18 t 0
52 40 0 0 category 19 t 0
53 52 0 0 category 20 t 0
55 40 0 0 category 21 t 0
\.
--
-- PostgreSQL database dump complete
--
When we set attr_readonly :parent_id and try to assign another parent to existing record, all indexes are recalculated to new parent but parent_id stays unchanged. So after save we have invalid indexes.
Hi,
I just started using the gem and playing with the Regions example. It seems only "Earth" has descendants. I would expect to get descendants for other nodes like "Oceania" but an empty list is returned.
Anscestors is work as expected.
Thanks,
Caio
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.