Sorting issues with some constraint and order on the labels, the title, the milestones and/or the body.

# S3 method for class 'IssuesTB'
sort(
  x,
  decreasing = FALSE,
  sorting_variables = list(),
  filtering_factors = list(),
  ...
)

Arguments

x

a IssuesTB object.

decreasing

logical. Should the sort be increasing or decreasing?

sorting_variables

a list containing the quantitative variables to sort the issues. The filters are applied in the order of the variables supplied.

filtering_factors

a list containing constraints for sorting issues by sub-group in order of priority

...

Additional arguments related to milestones for the function simple_sort.

Value

a IssuesTB object sorted.

Details

In the order of the constraints imposed by the filtering_factors argument, the function will first filter by constraint. For each constraint, the function will then sort according to the quantitative variables supplied in sorting_variables.

For example, the following call:


sort(
    x = issues,
    sorting_variables = list(c(object = "milestones", field = "due_on"),
                             c(object = "issues", field = "created_at")),
    filtering_factors = list(list(values = "bug",
                                  fields = "labels",
                                  values_logic_gate = "OR"),
                             list(values = "package", fields = "title")),
    decreasing = TRUE
)

will behave as follows:

    1. It will select all the issues that have "bug" as a label, then sort them according to the chronological order of milestones (according to deadlines) and the chronological order of issue creation dates

    1. Among the remaining issues, it will filter the issues that have "package" in the title and apply the same sorting.

    1. Finally, among all the remaining issues (not sorted until now), the function will apply the same sorting.

    1. The function returns the global list of sorted issues.

The argument filtering_factors is a list of constraint following the same naming convention as the filter_issues. So the constraints are represented by named lists with the various arguments (apart from x) to the filter_issues (values, fields, fields_logic_gate, values_logic_gate and negate).

Examples


# \donttest{
# Get the milestones of the prject
milestones <- get_milestones("online")
#> Reading milestones... 
#> Done! 0 milestones found.
write_milestones_to_dataset(milestones)
#> The datasets will be exported to /tmp/RtmpFk7oC2/data/list_milestones.yaml.
#> The file already exists and will be overwritten.

all_issues <- get_issues(source = "online", verbose = FALSE)
sorted_issues <- sort(
    x = all_issues,
    sorting_variables = list(list(object = "milestones", field = "due_on"),
                             list(object = "issues", field = "created_at")),
    filtering_factors = list(list(values = "bug",
                                  fields = "labels",
                                  values_logic_gate = "OR"),
                             list(values = "package", fields = "title")),
    milestones = milestones
)
# }