Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 2 files changed
  • 0 comments
  • 1 contributor
16 assets/javascripts/app/events.js
@@ -4,23 +4,19 @@ GiddyUp.EventProcessor = Ember.Object.extend({
4 4
5 5 this.source.addEventListener('test_result', function(e) {
6 6 var parsedResponse = JSON.parse(e.data);
7   - var testResult = parsedResponse.test_result;
8   -
9   - // Load the new test result into the store.
10   - //
11   - GiddyUp.store.load(GiddyUp.TestResult, testResult);
  7 + var rawTestResult = parsedResponse.test_result;
  8 + var testResult = GiddyUp.TestResult.loadRawTestResult(
  9 + rawTestResult);
12 10
13 11 // Notification handling.
14 12 //
15 13 if (window.webkitNotifications &&
16 14 window.webkitNotifications.checkPermission() === 0) {
17   -
18   - var result = GiddyUp.TestResult.find(testResult.id);
19   - var message = result.get('notification');
  15 + var message = testResult.get('notification');
20 16
21 17 window.webkitNotifications.createNotification(
22   - "icon.png", message.title, message.message
23   - ).show();
  18 + "icon.png", message.title, message.message).
  19 + show();
24 20 }
25 21 });
26 22 }
14 assets/javascripts/app/models.js
@@ -90,6 +90,20 @@ GiddyUp.TestResult = DS.Model.extend({
90 90 }.property()
91 91 });
92 92
  93 +GiddyUp.TestResult.reopenClass({
  94 + /** Load record, immediately materialize, and force listening array
  95 + ** proxies to reference object. */
  96 + loadRawTestResult: function(rawTestResult) {
  97 + var newTestResult = GiddyUp.store.load(GiddyUp.TestResult,
  98 + rawTestResult);
  99 + var testResult = GiddyUp.TestResult.find(newTestResult.id);
  100 +
  101 + testResult.get('test_instance.test_results').pushObject(testResult);
  102 +
  103 + return testResult;
  104 + }
  105 +});
  106 +
93 107 GiddyUp.Log = DS.Model.extend({
94 108 body: DS.attr('string'),
95 109

No commit comments for this range

Something went wrong with that request. Please try again.