ID Controller - gpaOliveira/SuperDiffer GitHub Wiki

Obtained from file: SuperDiffer/id/controllers.py

Controller methods file, where the models are used and their information is server to routes or tests.

count method

Helper testing function to count all IDs

list method

Helper testing function to list all IDs

add method

Add a description and a data to our model - rollback and return False if anything goes wrong (PK not respected, for example)

remove method

Remove a descriptor from an ID on our model - rollback and return False if anything goes wrong (register not found, for example)

remove_all method

Remove a list of descriptors from a single ID on our model - rollback and return False if anything goes wrong (any register not found, for example)

grab_descriptors_values_to_diff method

Grab all the descriptors values to diff or get out

grab_pairs_keys_to_compare method

Grab all pair of keys to compare

find_diff_indexes_and_lenght_on_same_size_values method

Find the diff indexes and lenght of the difference, as follows below, and return on an array of diffs. Some more details follows below:

(a) on the first different char in a sequence, save that index on a buffer along with the sequence lenght (only 1 for now)

(b) on the successive different chars in a sequence, increment the lenght of the sequence on the buffer

(c) on the first equal char after a sequence of differences, add the buffer to our list and reset it if needed

diff_values method

Compute insights on where the diffs are and their lenght on strings with the same size (without using https://docs.python.org/2/library/difflib.html)

  • Initialize returned struct in the format: {"size":"equal", "diffs":[]}
  • Doesn't compare different size strings
  • Save the diffs obtained go to diffs entry

diff method

Calculates the difference on values of all the pairs of descriptors to diff from a given ID

  • Grab the values to diff - if all the values are not present on that ID, return None
  • Grab the key pairs to compare - if no pair is given or found, return None
  • For each pair, calculate the diff between their components values