MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003988ATutorContentpublic2009-11-09 07:292009-11-16 05:50
ReporterIndieRect 
Assigned Tocindy 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.6.3 
Target VersionFixed in Version1.6.4 
Summary0003988: Previous Topic link may be wrong when there're tests associated with content
DescriptionIt's a problem with a data structure, so I'll show on an example.
Consider a content page with ID=101 and some subpages. The page tree is stored in ContentManager._menu array; there we may have something like this:
      
[101] => Array
      (
            [0] => Array
                  (
                        [content_id] => 103
                        [ordering] => 1
                        [title] => First Content Page
                  )

            [1] => Array
                  (
                        [content_id] => 107
                        [ordering] => 2
                        [title] => Second Content Page
                  )

            [2] => Array
                  (
                        [content_id] => 108
                        [ordering] => 3
                        [title] => Third Content Page
                  )

Let's say we're on the Third Content Page now.
To get a link for the Previous Topic, function ContentManager->getPreviousContent() is called. It takes 'ordering' of this page (3), subtracts 2 (a constant), and picks a page from this subtree with that index (3-2=1, so it's Second Content Page). So far, so good.


Now let's associate some tests with page ID=101. In that array, we'll get this:

[101] => Array
      (
            [0] => Array
                  (
                        [test_id] => 25
                        [title] => First Test
                  )

            [1] => Array
                  (
                        [test_id] => 26
                        [title] => Second Test
                  )

            [2] => Array
                  (
                        [content_id] => 103
                        [ordering] => 1
                        [title] => First Content Page
                  )

            [3] => Array
                  (
                        [content_id] => 107
                        [ordering] => 2
                        [title] => Second Content Page
                  )

            [4] => Array
                  (
                        [content_id] => 108
                        [ordering] => 3
                        [title] => Third Content Page
                  )

Let's say we're on Third Content Page again.
The 'ordering' is unchanged, so the calculation of previous page index will be the same: 3-2=1. When the function picks an element with index 1, it's Second Test. As this isn't a content page, the function fetches its parent, the page with ID=101.

Here's the problem:
When tests are present on the same level of the page tree, the "previous" counter is always off by the number of tests.
It's a real problem when you need to automatically traverse the tree to perform some task, and you can't expect a user to intervene if something goes wrong (as can be done with Prev/Next navigation).
TagsNo tags attached.
Affects versionSVN
SVN Revision#
Attached Files

- Relationships

-  Notes
(0003852)
cindy (administrator)
2009-11-09 11:00

The content order has been re-done in 1.6.4. Please have a look when the beta comes out. Thanks.
(0003853)
IndieRect (reporter)
2009-11-09 22:56

Thanks. Anticipating.
(0003858)
greg (administrator)
2009-11-12 02:51

This may have been fixed already. Cindy will check.
(0003862)
cindy (administrator)
2009-11-13 09:42

Indie, what do you mean? The "Prev" button should go into test or skip the test?

The current way is always skip the test. And, in the new content structure, 1.6.4, all parent contents will be content folders that have no content itself but hold content nodes as children, so that the test will not have a chance to be in the same level of the content.
(0003866)
IndieRect (reporter)
2009-11-13 11:54

I didn't say anything about skipping a test or going into it. I'm saying just what I've already said: under the given conditions getPreviousContent() returns a content item that is certain number of positions away from the correct one.

The changes in 1.6.4 as you've described them would preclude this specific problem. So, depending on your schedule for its release, patching this bug specifically for 1.6.3 might be worthless.
(0003870)
cindy (administrator)
2009-11-16 05:50

Would not occur according to the new content structure in 1.6.4

- Issue History
Date Modified Username Field Change
2009-11-09 07:29 IndieRect New Issue
2009-11-09 07:29 IndieRect Affects version => SVN
2009-11-09 11:00 cindy Note Added: 0003852
2009-11-09 22:56 IndieRect Note Added: 0003853
2009-11-12 02:50 greg Status new => assigned
2009-11-12 02:50 greg Assigned To => cindy
2009-11-12 02:51 greg Note Added: 0003858
2009-11-13 09:42 cindy Note Added: 0003862
2009-11-13 11:54 IndieRect Note Added: 0003866
2009-11-16 05:50 cindy Status assigned => closed
2009-11-16 05:50 cindy Note Added: 0003870
2009-11-16 05:50 cindy Resolution open => fixed
2009-11-16 05:50 cindy Fixed in Version => 1.6.4


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker