<commit_before>/* eslint ember/order-in-routes: 0 */
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';

export default Route.extend({
  currentUser: service(),
  titleToken: 'general.<PASSWORD>',
  model(){
    return this.get('currentUser.model').then(user => {
      return user.get('schools').then(schools => {
        return user.get('school').then(primarySchool => {
          return {
            primarySchool,
            schools
          };
        });
      });
    });
  },
  queryParams: {
    filter: {
      replace: true
    }
  }
});<commit_msg>Lookup schools correctly<commit_after>/* eslint ember/order-in-routes: 0 */
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import { filter } from 'rsvp';

export default Route.extend({
  currentUser: service(),
  store: service(),
  permissionChecker: service(),
  titleToken: 'general.<PASSWORD>',
  async model(){
    const currentUser = this.get('currentUser');
    const store = this.get('store');
    const permissionChecker = this.get('permissionChecker');
    const allSchools = await store.findAll('school');
    const schools = await filter(allSchools.toArray(), async school => {
      return permissionChecker.canUpdateUserInSchool(school);
    });

    const user = await currentUser.get('model');
    const primarySchool = await user.get('school');

    return {
      primarySchool,
      schools
    };
  },
  queryParams: {
    filter: {
      replace: true
    }
  }
});
{'fraction_non_alphanumeric': 0.1461038961038961, 'fraction_numerical': 0.0012987012987012987, 'mean_word_length': 3.0659630606860158, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '1666928', 'n_tokens_mistral': 443, 'n_tokens_neox': 445, 'n_words': 104}