Skip to content

Commit

Permalink
Merge branch 'release-5.17.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokiterashima committed Oct 21, 2020
2 parents 2f68db3 + 94e92fc commit 1eb47e1
Show file tree
Hide file tree
Showing 31 changed files with 346 additions and 536 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wise",
"version": "5.17.3",
"version": "5.17.4",
"description": "Web-based Inquiry Science Environment",
"main": "app.js",
"browserslist": [
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<artifactId>wise</artifactId>
<packaging>war</packaging>
<name>Web-based Inquiry Science Environment</name>
<version>5.17.3</version>
<version>5.17.4</version>
<url>http://wise5.org</url>
<licenses>
<license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void serialize(Annotation annotation, JsonGenerator gen, SerializerProvid
throws IOException {
gen.writeStartObject();
gen.writeObjectField("id", annotation.getId());
gen.writeObjectField("clientSaveTime", annotation.getClientSaveTime());
gen.writeObjectField("clientSaveTime", annotation.getClientSaveTime().getTime());
gen.writeObjectField("componentId", annotation.getComponentId());
ObjectMapper objectMapper = new ObjectMapper();
gen.writeObjectField("data", objectMapper.readTree(annotation.getData()));
Expand All @@ -35,12 +35,12 @@ public void serialize(Annotation annotation, JsonGenerator gen, SerializerProvid
}
gen.writeObjectField("periodId", annotation.getPeriod().getId());
gen.writeObjectField("runId", annotation.getRun().getId());
gen.writeObjectField("serverSaveTime", annotation.getServerSaveTime());
gen.writeObjectField("serverSaveTime", annotation.getServerSaveTime().getTime());
StudentWork studentWork = annotation.getStudentWork();
if (studentWork != null) {
gen.writeObjectField("studentWorkId", studentWork.getId());
}
gen.writeObjectField("type", annotation.getType());
gen.writeEndObject();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ public void serialize(Notification notification, JsonGenerator gen,
} else {
gen.writeObjectField("data", null);
}
gen.writeObjectField("timeGenerated", notification.getTimeGenerated());
gen.writeObjectField("serverSaveTime", notification.getServerSaveTime());
gen.writeObjectField("timeDismissed", notification.getTimeDismissed());
gen.writeObjectField("timeGenerated", notification.getTimeGenerated().getTime());
gen.writeObjectField("serverSaveTime", notification.getServerSaveTime().getTime());
if (notification.getTimeDismissed() != null) {
gen.writeObjectField("timeDismissed", notification.getTimeDismissed().getTime());
}
gen.writeEndObject();
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/wise/vle/domain/work/EventSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void serialize(Event event, JsonGenerator gen, SerializerProvider seriali
gen.writeStartObject();
gen.writeObjectField("id", event.getId());
gen.writeObjectField("category", event.getCategory());
gen.writeObjectField("clientSaveTime", event.getClientSaveTime());
gen.writeObjectField("clientSaveTime", event.getClientSaveTime().getTime());
gen.writeObjectField("componentId", event.getComponentId());
gen.writeObjectField("componentType", event.getComponentType());
gen.writeObjectField("context", event.getContext());
Expand All @@ -41,7 +41,7 @@ public void serialize(Event event, JsonGenerator gen, SerializerProvider seriali
if (run != null) {
gen.writeObjectField("runId", run.getId());
}
gen.writeObjectField("serverSaveTime", event.getServerSaveTime());
gen.writeObjectField("serverSaveTime", event.getServerSaveTime().getTime());
Workgroup workgroup = event.getWorkgroup();
if (workgroup != null) {
gen.writeObjectField("workgroupId", workgroup.getId());
Expand All @@ -52,4 +52,4 @@ public void serialize(Event event, JsonGenerator gen, SerializerProvider seriali
}
gen.writeEndObject();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ public void serialize(NotebookItem item, JsonGenerator gen, SerializerProvider s
gen.writeStringField("type", item.getType());
gen.writeStringField("localNotebookItemId", item.getLocalNotebookItemId());
gen.writeStringField("content", item.getContent());
gen.writeObjectField("clientSaveTime", item.getClientSaveTime());
gen.writeObjectField("serverSaveTime", item.getServerSaveTime());
gen.writeObjectField("clientDeleteTime", item.getClientDeleteTime());
gen.writeObjectField("serverDeleteTime", item.getServerDeleteTime());
gen.writeObjectField("clientSaveTime", item.getClientSaveTime().getTime());
gen.writeObjectField("serverSaveTime", item.getServerSaveTime().getTime());
if (item.getClientDeleteTime() != null) {
gen.writeObjectField("clientDeleteTime", item.getClientDeleteTime().getTime());
}
if (item.getServerDeleteTime() != null) {
gen.writeObjectField("serverDeleteTime", item.getServerDeleteTime().getTime());
}
if (item.getType().equals("note")) {
addNoteFields(gen, item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ public void serialize(StudentWork studentWork, JsonGenerator gen, SerializerProv
throws IOException {
gen.writeStartObject();
gen.writeObjectField("id", studentWork.getId());
gen.writeObjectField("clientSaveTime", studentWork.getClientSaveTime());
gen.writeObjectField("clientSaveTime", studentWork.getClientSaveTime().getTime());
gen.writeObjectField("componentId", studentWork.getComponentId());
gen.writeObjectField("componentType", studentWork.getComponentType());
gen.writeObjectField("isAutoSave", studentWork.getIsAutoSave());
gen.writeObjectField("isSubmit", studentWork.getIsSubmit());
gen.writeObjectField("nodeId", studentWork.getNodeId());
gen.writeObjectField("periodId", studentWork.getPeriod().getId());
gen.writeObjectField("runId", studentWork.getRun().getId());
gen.writeObjectField("serverSaveTime", studentWork.getServerSaveTime());
gen.writeObjectField("serverSaveTime", studentWork.getServerSaveTime().getTime());
ObjectMapper objectMapper = new ObjectMapper();
gen.writeObjectField("studentData", objectMapper.readTree(studentWork.getStudentData()));
gen.writeObjectField("workgroupId", studentWork.getWorkgroup().getId());
gen.writeEndObject();
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.17.3
5.17.4
18 changes: 17 additions & 1 deletion src/main/webapp/site/src/app/services/matchService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('MatchService', () => {
isCompleted();
componentStateHasStudentWork();
hasCorrectAnswer();
getItemById();
});

function createMatchComponent(choices: any[], buckets: any[], feedback: any[]) {
Expand Down Expand Up @@ -67,7 +68,7 @@ function createChoice(id: string, value: string) {
return {
id: id,
value: value,
type: 'string'
type: 'choice'
};
}

Expand Down Expand Up @@ -185,4 +186,19 @@ function hasCorrectAnswer() {
component.feedback[0].choices[1].isCorrect = true;
expectHasCorrectAnswer(component, true);
});
}

function getItemById() {
const item1 = createChoice('item1', 'Item 1');
const item2 = createChoice('item2', 'Item 2');
const items: any[] = [
item1,
item2
];
it('should get the item by id when the id exists', () => {
expect(service.getItemById('item1', items)).toEqual(item1);
});
it('should return null when the item id does not exist', () => {
expect(service.getItemById('item3', items)).toEqual(null);
});
}
16 changes: 16 additions & 0 deletions src/main/webapp/site/src/app/services/projectService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ describe('ProjectService', () => {
deleteTheLastStepInAnActivity();
deleteAllStepsInAnActivity();
getTags();
addCurrentUserToAuthors_CM_shouldAddUserInfo();
// TODO: add test for service.getFlattenedProjectAsNodeIds()
// TODO: add test for service.getAllPaths()
// TODO: add test for service.consolidatePaths()
Expand Down Expand Up @@ -1044,3 +1045,18 @@ function getTags() {
expect(tags[1].name).toEqual('Group 2');
});
}

function addCurrentUserToAuthors_CM_shouldAddUserInfo() {
it('should add current user to authors in CM mode', () => {
spyOn(configService, 'getMyUserInfo').and.returnValue({
userIds: [1],
firstName: 'wise',
lastName: 'panda',
username: 'wisepanda'
});
spyOn(configService, 'isClassroomMonitor').and.returnValue(true);
const authors = service.addCurrentUserToAuthors([]);
expect(authors.length).toEqual(1);
expect(authors[0].id).toEqual(1);
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { ConfigService } from "../../../services/configService";
import { NodeService } from "../../../services/nodeService";
import { TeacherProjectService } from "../../../services/teacherProjectService";

class EditComponentController {

componentId: string;
nodeId: string;

static $inject = ['$scope', 'ConfigService', 'NodeService', 'ProjectService'];

constructor(private $scope: any, private ConfigService: ConfigService,
private NodeService: NodeService, private ProjectService: TeacherProjectService) {
}

$onInit() {
this.$scope.mode = 'authoring';
const authoringComponentContent = this.ProjectService.getComponentByNodeIdAndComponentId(this.nodeId, this.componentId);
const componentContent = this.ConfigService.replaceStudentNames(
this.ProjectService.injectAssetPaths(authoringComponentContent));
this.$scope.authoringComponentContent = authoringComponentContent;
this.$scope.nodeAuthoringController = this.$scope.$parent.nodeAuthoringController;
this.$scope.componentTemplatePath = this.NodeService.getComponentAuthoringTemplatePath(componentContent.type);
this.$scope.componentContent = componentContent;
this.$scope.nodeId = this.nodeId;
this.$scope.type = componentContent.type;
}
}

const EditComponent = {
bindings: {
componentId: '@',
nodeId: '@'
},
scope: true,
controller: EditComponentController,
template:
`<div class="component__wrapper">
<div ng-include="::componentTemplatePath" class="component__content component__content--{{::type}}"></div>
</div>`
};

export default EditComponent;
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import StepTools from './stepTools/stepTools';
import Toolbar from './toolbar/toolbar';
import TopBar from './topBar/topBar';
import * as angular from 'angular';
import EditComponent from '../edit-component/editComponent';

const SharedComponents = angular
.module('sharedComponents', [])
.component('editComponent', EditComponent)
.component('atMainMenu', MainMenu)
.component('atSideMenu', SideMenu)
.component('atStepTools', StepTools)
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/wise5/authoringTool/node/node.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ <h6 ng-if="projectController.isGroupNode(nodeAuthoringController.node.id)">{{ ::
<md-tooltip md-direction='top' class='projectButtonTooltip'>{{ ::"insertAfter" | translate }}</md-tooltip>
</md-button>
</div>
<component ng-if='nodeAuthoringController.showComponentAuthoringViews' node-id='{{nodeAuthoringController.nodeId}}' component-id='{{component.id}}' mode='authoring'></component>
<edit-component ng-if='nodeAuthoringController.showComponentAuthoringViews' node-id='{{nodeAuthoringController.nodeId}}' component-id='{{component.id}}'></edit-component>
<md-divider ng-if='nodeAuthoringController.showComponentAuthoringViews && !$last'></md-divider>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,9 @@ class NavItemController {
} else {
this.lockNode(node);
}
this.ProjectService.saveProject().then(response => {
if (response.status === 'success') {
this.sendNodeToClass(node);
this.showToggleLockNodeConfirmation(!isLocked);
}
this.ProjectService.saveProject().then(() => {
this.sendNodeToClass(node);
this.showToggleLockNodeConfirmation(!isLocked);
});
}

Expand Down
11 changes: 11 additions & 0 deletions src/main/webapp/wise5/components/componentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class ComponentController {
nodeSubmitClickedSubscription: Subscription;
audioRecordedSubscription: Subscription;
notebookItemChosenSubscription: Subscription;
snipImageSubscription: Subscription;
studentWorkSavedToServerSubscription: Subscription;
starterStateRequestSubscription: Subscription;

Expand Down Expand Up @@ -192,6 +193,15 @@ class ComponentController {
}

$onInit() {
this.snipImageSubscription =
this.ProjectService.snipImage$.subscribe(({ target, componentId }) => {
if (componentId === this.componentId) {
const imageObject = this.UtilService.getImageObjectFromImageElement(target);
if (imageObject != null) {
this.NotebookService.addNote(imageObject);
}
}
});
this.starterStateRequestSubscription =
this.NodeService.starterStateRequest$.subscribe((args: any) => {
if (this.isForThisComponent(args)) {
Expand Down Expand Up @@ -263,6 +273,7 @@ class ComponentController {
if (this.notebookItemChosenSubscription != null) {
this.notebookItemChosenSubscription.unsubscribe();
}
this.snipImageSubscription.unsubscribe();
this.starterStateRequestSubscription.unsubscribe();
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/wise5/components/graph/authoring.html
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ <h6>{{ ::'graph.seriesNumbers' | translate }}</h6>
<md-input-container style='margin-right: 20px; width: 120px;'>
<label>{{ ::'graph.plotType' | translate }}</label>
<md-select ng-model='graphController.authoringComponentContent.graphType'
ng-change='graphController.authoringViewComponentChanged()'
ng-change='graphController.graphTypeChanged()'
style='width: 120px'>
<md-option ng-repeat='availableGraphType in graphController.availableGraphTypes'
value='{{availableGraphType.value}}'>
Expand Down Expand Up @@ -789,7 +789,7 @@ <h6>{{ ::'graph.series' | translate }}</h6>
ng-if='graphController.authoringComponentContent.graphType == "line" || graphController.authoringComponentContent.graphType == "scatter"'>
<label>{{ ::'graph.type' | translate }}</label>
<md-select ng-model='series.type'
ng-change='graphController.authoringViewComponentChanged()'
ng-change='graphController.seriesTypeChanged(series)'
style='width: 120px'>
<md-option ng-repeat='availableSeriesType in graphController.availableSeriesTypes'
value='{{availableSeriesType.value}}'>
Expand Down
Loading

0 comments on commit 1eb47e1

Please sign in to comment.