<commit_before>Application.Controllers.controller('viewMeasurementController',
    ["$scope", "project", "$state", "$log", "modal", "mcapi", "pubsub", viewMeasurementController]);

function viewMeasurementController($scope, project, $state, $log, modal, mcapi, pubsub) {
    $scope.modal = modal;
    this.all = project.processes;
    $scope.selected = {
        item: {}
    };
    processColumns();
    function updateBestMeasure() {
        mcapi('/best_measure')
            .success(function () {
                pubsub.send('updateBestMeasurement');
            }).post({
                property_id: $scope.modal.property.property_id,
                measurement_id: $scope.selected.item.measurement_id
            })
    }

    $scope.ok = function () {
        updateBestMeasure();
        $scope.modal.instance.close($scope.selected.item);
        $state.go('projects.project.samples.edit');
    };

    $scope.cancel = function () {
        $scope.modal.instance.dismiss('cancel');
    };

    $scope.modal.instance.result.then(function (selectedItem) {
        $scope.selected = selectedItem;
    }, function () {
        $log.info('Modal dismissed at: ' + new Date());
    });

    function processColumns(){
        $scope.modal.property.measurements.forEach(function(measure){
            if(measure._type === 'line' || measure._type === 'histogram'){
                measure.categories = measure.value.categories.split("\n");
                measure.values = measure.value.values.split("\n");
            }
            //Setting radio button to checked if best measure is already present
            if($scope.modal.property.best_measure.length > 0){
                if(measure.measurement_id === $scope.modal.property.best_measure[0].id){
                    $scope.selected.item = measure;<commit_msg>Go to correct page after editing the best measure for a sample.<commit_after>Application.Controllers.controller('viewMeasurementController',
    ["$scope", "project", "$state", "$log", "modal", "mcapi", "pubsub", viewMeasurementController]);

function viewMeasurementController($scope, project, $state, $log, modal, mcapi, pubsub) {
    $scope.modal = modal;
    this.all = project.processes;
    $scope.selected = {
        item: {}
    };
    processColumns();
    function updateBestMeasure() {
        mcapi('/best_measure')
            .success(function () {
                pubsub.send('updateBestMeasurement');
            }).post({
                property_id: $scope.modal.property.property_id,
                measurement_id: $scope.selected.item.measurement_id
            })
    }

    $scope.ok = function () {
        updateBestMeasure();
        $scope.modal.instance.close($scope.selected.item);
        $state.go('projects.project.samples.all.edit');
    };

    $scope.cancel = function () {
        $scope.modal.instance.dismiss('cancel');
    };

    $scope.modal.instance.result.then(function (selectedItem) {
        $scope.selected = selectedItem;
    }, function () {
        $log.info('Modal dismissed at: ' + new Date());
    });

    function processColumns(){
        $scope.modal.property.measurements.forEach(function(measure){
            if(measure._type === 'line' || measure._type === 'histogram'){
                measure.categories = measure.value.categories.split("\n");
                measure.values = measure.value.values.split("\n");
            }
            //Setting radio button to checked if best measure is already present
            if($scope.modal.property.best_measure.length > 0){
                if(measure.measurement_id === $scope.modal.property.best_measure[0].id){
                    $scope.selected.item = measure;
{'fraction_non_alphanumeric': 0.14626218851570963, 'fraction_numerical': 0.0010834236186348862, 'mean_word_length': 2.4905482041587903, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1377723', 'n_tokens_mistral': 1006, 'n_tokens_neox': 984, 'n_words': 170}