Giter Site home page Giter Site logo

acts_as_nested_interval's People

Contributors

clyfe avatar grzlus avatar klobuczek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

acts_as_nested_interval's Issues

Incorrect lftp and lftq calculation

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
--

attr_readonly :parent_id

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.

Does descendants only work for the root node?

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.