Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Convert Subjects into POJOs when making Recents #38

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions models/recent.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/models/recent.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class Recent extends BaseModel
@created_at ||= (new Date).toUTCString()

for subject, i in @subjects
if subject.constructor is Subject
subject = JSON.parse(JSON.stringify(subject))

@subjects[i] = new SubjectForRecent subject

window.zooniverse.models.Recent = Recent
Expand Down
10 changes: 5 additions & 5 deletions zooniverse.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Zooniverse Library - v0.6.11
* Zooniverse Library - v0.6.12
*/
;(function(window) {
window.base64 = {
Expand Down Expand Up @@ -1429,11 +1429,8 @@ window.base64 = {
}
BaseModel.__super__.constructor.apply(this, arguments);
for (property in params) {
if (!__hasProp.call(params, property)) continue;
value = params[property];
if (property in this) {
this[property] = value;
}
this[property] = value;
}
this.constructor.idCounter += 1;
if (this.id == null) {
Expand Down Expand Up @@ -2100,6 +2097,9 @@ window.base64 = {
_ref4 = this.subjects;
for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) {
subject = _ref4[i];
if (subject.constructor === Subject) {
subject = JSON.parse(JSON.stringify(subject));
}
this.subjects[i] = new SubjectForRecent(subject);
}
}
Expand Down
4 changes: 2 additions & 2 deletions zooniverse.min.js

Large diffs are not rendered by default.