<commit_before>'use strict';
var $ = require('jquery');
var ko = require('knockout');
var Raven = require('raven-js');

var $osf = require('js/osfHelpers');

var ViewModel = function(data) {
    var self = this;
    self.primaryInstitution = ko.observable('None');
    self.institutionHref = ko.observable('');
    self.availableInstitutions = ko.observable(false);
    self.selectedInstitution = ko.observable();

    self.fetchUserInstitutions = function() {
        var url = ctx.apiV2Prefix + 'users/' + ctx.currentUser.id + '/?embed=institutions';
        return $osf.ajaxJSON(
            'GET',
            url,
            {isCors: true}
        ).done(function (response) {
            if (response.data.embeds.institutions.data.length){
                self.availableInstitutions(response.data.embeds.institutions.data);
            }
        }).fail(function (xhr, status, error) {
            Raven.captureMessage('Unable to fetch user with embedded institutions', {
                url: url,
                status: status,
                error: error
            });
        });
    };
    self.fetchNodeInstitutions = function() {
        var url = data.apiV2Prefix + 'nodes/' + data.node.id + '/?embed=primary_institution';
        return $osf.ajaxJSON(
            'GET',
            url,
            {isCors: true}<commit_msg>fix institutionProjectSettings by changing ctx to data<commit_after>'use strict';
var $ = require('jquery');
var ko = require('knockout');
var Raven = require('raven-js');

var $osf = require('js/osfHelpers');

var ViewModel = function(data) {
    var self = this;
    self.primaryInstitution = ko.observable('None');
    self.institutionHref = ko.observable('');
    self.availableInstitutions = ko.observable(false);
    self.selectedInstitution = ko.observable();

    self.fetchUserInstitutions = function() {
        var url = data.apiV2Prefix + 'users/' + data.currentUser.id + '/?embed=institutions';
        return $osf.ajaxJSON(
            'GET',
            url,
            {isCors: true}
        ).done(function (response) {
            if (response.data.embeds.institutions.data.length){
                self.availableInstitutions(response.data.embeds.institutions.data);
            }
        }).fail(function (xhr, status, error) {
            Raven.captureMessage('Unable to fetch user with embedded institutions', {
                url: url,
                status: status,
                error: error
            });
        });
    };
    self.fetchNodeInstitutions = function() {
        var url = data.apiV2Prefix + 'nodes/' + data.node.id + '/?embed=primary_institution';
        return $osf.ajaxJSON(
            'GET',
            url,
            {isCors: true}
{'fraction_non_alphanumeric': 0.13245517746066593, 'fraction_numerical': 0.0014635931211123307, 'mean_word_length': 2.2355029585798816, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2394845', 'n_tokens_mistral': 797, 'n_tokens_neox': 783, 'n_words': 159}