performQuery(query: any): Promise <InsightResponse> { //read query, clone let that = this; return new Promise((fulfill, reject) => { let datasets : Dataset[]; datasets = that.datasetManager.getDatasetsFromDisk(); if (!that.datasetManager.checkInMemory("courses")) { reject({code: 424, body: {"error": "the query failed because of a missing dataset"}}); return; } // let courseDataset: Dataset = that.datasetManager.getDataset("courses"); let courseDataset: Dataset = datasets[0]; let allCourseSections: CourseObject[] = that.datasetManager.getCourseObjs(courseDataset); let queryToFulfill: Query = new Query(); let queryParseResponse: ParseResponse = queryToFulfill.parse(query, allCourseSections); if (!queryParseResponse.valid) { reject({code: 400, body: {"error": "the query failed because the keys were invalid"}}); return; } var ir: InsightResponse = query.interpret(); fulfill(ir); return; }); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.