•  
      request #14467 Massive update of the rank of form element fields
    Infos
    #14467
    Bruno Gabrielli (bruno.gabrielli)
    2020-02-03 17:09
    2020-01-31 15:48
    15706
    Details
    Massive update of the rank of form element fields

    Hi everyone.

    In Tracker Administration, specifically in Field Usage Administration, when we change the position of a specific field, the system changes its "rank". The rank is how the system locates the position of the field in its level of the tree of components.

    When you do it, the system executes the function "prepareRanking" of the class "\DataAccessObject". This update the rank os all elements with the same parent component.

    The problem is when you change the location of a field on the root of the tracker. Its parent component id is 0. So, the function can execute this code:

     

                        $sql = sprintf(
                            'UPDATE '. $this->table_name .
                                   ' SET '. $rank_key .' = '. $rank_key .' + 1'.
                                   ' WHERE '. $parent_key .' = %d'.
                                   '  AND '. $rank_key .' >= %d',
                            $parent_id,
                            $rank
                        );
                        $updated = $this->update($sql);
    

    with $parent_id = 0.

    So, it can change the rank of almost all fields located on the root of the all trackers of the database.

    I think it can be improved with the use of the tracker_id or something like this.

    In my company we do some periodical comparision of trackers to make some reports and ever the rank of the components are different.

    For example, today, the rank of the components of an old tracker is greater the 5000.

    Trackers
    11.8
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Nicolas Terray (nterray)
    Closed
    2020-02-03
    Attachments
    Empty
    References
    Referencing request #14467
    Referenced by request #14467

    Artifact Tracker v5

    rel #14138 11.11

    Follow-ups

    User avatar
    Thomas Gerbet (tgerbet)2020-02-03 17:09
    Integrated into Tuleap 11.10.99.225.

    • Status changed from Under review to Closed
    • Connected artifacts
    • Close date set to 2020-02-03