Commit 84b67797 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

improved layout for matching exercise

parent d4b30506
......@@ -3,7 +3,7 @@
<name>mcClient</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content original-src="index.html" src="http://192.168.1.9:8100" />
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
......@@ -79,6 +79,5 @@
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-ionic-keyboard" spec="2.0.5" />
<plugin name="cordova-plugin-ionic-webview" spec="^2.2.5" />
<allow-navigation href="http://192.168.1.9:8100" sessionid="5af1af03" />
<engine name="android" spec="7.0.0" />
<engine name="android" spec="~7.0.0" />
</widget>
{
"name": "mcClient",
"version": "0.3.1",
"version": "0.3.4",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
......
......@@ -13,8 +13,6 @@ import {HelperProvider} from "../../providers/helper/helper";
import {TranslateService} from "@ngx-translate/core";
import {CorpusProvider} from "../../providers/corpus/corpus";
import {QueryMC} from "../../models/queryMC";
import {HomePage} from "../home/home";
import {FeedbackPage} from "../feedback/feedback";
/**
* Generated class for the ExerciseParametersPage page.
......
......@@ -43,7 +43,7 @@
<ion-col>
<!-- Do not use non-breaking whitespaces (&nbsp;). If you do, some browsers will start breaking lines on a character basis (after a resize occurred), which results in single words being cut into pieces at the end of a line. Use &#32; instead. -->
<div *ngFor="let node of exerciseProvider.annisResponse?.graph.nodes">
{{ nodeIdSet.has(node.id) ? "_".repeat(maxGapLength) : node.annis_tok }}&#32;
{{ solutionNodeIdSet.has(node.id) ? "_".repeat(maxGapLength) : node.annis_tok }}&#32;
</div>
</ion-col>
</ion-row>
......@@ -58,17 +58,21 @@
</ion-col>
</ion-row>
<ion-row>
<ion-col col-2>
<ion-col class="first">
<h5>{{ "GIVEN" | translate }}</h5>
</ion-col>
<ion-col col-10>
<ion-col>
<h5>{{ "WANTED" | translate }}</h5>
</ion-col>
</ion-row>
<ion-row
*ngFor="let solution of (areSolutionsShuffled ? solutionsShuffled : exerciseProvider.annisResponse.solutions)">
<ion-col col-2>{{solution.target.content}}</ion-col>
<ion-col col-10>{{solution.value.content}}</ion-col>
<ion-col class="first">
{{solution.target.content}}
</ion-col>
<ion-col>
{{solution.value.content}}
</ion-col>
</ion-row>
</ion-grid>
</ng-template>
......
......@@ -12,4 +12,7 @@ page-preview {
div {
display: inline;
}
.first {
max-width: 250px;
}
}
......@@ -33,7 +33,7 @@ export class PreviewPage {
public areSolutionsShuffled: boolean = false;
public currentNodes: NodeMC[] = [];
public maxGapLength: number = 0;
public nodeIdSet: Set<string> = new Set<string>();
public solutionNodeIdSet: Set<string> = new Set<string>();
showInstructions: boolean = false;
constructor(public navCtrl: NavController, public navParams: NavParams,
......@@ -81,7 +81,7 @@ export class PreviewPage {
private processAnnisResponse(ar: AnnisResponse) {
if (this.exerciseProvider.exercise.type === ExerciseType.cloze) {
this.maxGapLength = Math.max.apply(Math, ar.solutions.map(x => x.target.content.length));
this.nodeIdSet = new Set(ar.solutions.map(x => x.target.salt_id));
this.solutionNodeIdSet = new Set(ar.solutions.map(x => x.target.salt_id));
}
let targets: SolutionElement[] = ar.solutions.map(x => x.target).sort(() => {
// TODO: for really random shuffling, implement the Fisher-Yates Shuffle algorithm
......@@ -93,7 +93,9 @@ export class PreviewPage {
ar.solutions.sort((s1, s2) => {
return s1.target.content < s2.target.content ? -1 : (s1.target.content > s2.target.content ? 1 : 0);
});
this.exerciseProvider.annisResponse.uri = ar.uri;
this.exerciseProvider.annisResponse.solutions = ar.solutions;
this.exerciseProvider.annisResponse.graph = this.corpusProvider.currentUrn.startsWith("urn:") ? this.exerciseProvider.annisResponse.graph : ar.graph;
}
getNodeById(id: string) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment