Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

CLC-90 Add department code to class page feed #2

Merged
merged 1 commit into from

1 participant

@raydavis
Owner

No description provided.

@raydavis
Owner

Updated to remove some unneeded changes.

@raydavis raydavis merged commit 4d1a625 into from
@ctweney ctweney referenced this pull request from a commit
@ctweney ctweney Squashed commit of the following:
commit 7921b36
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Wed Dec 5 09:34:26 2012 -0800

    CLC-696 Tweak log levels, set default log level back to WARN

commit b423ffd
Merge: 1645939 88478ab
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Wed Dec 5 09:04:11 2012 -0800

    Merge pull request #2 from yuhunglin/CLC-696

    Timezone aware fixes

commit 88478ab
Author: Yu-Hung Lin <yuhung@yuhunglin.com>
Date:   Wed Dec 5 05:44:32 2012 -0800

    fixes on element on edge case of day_after_tomorrow, not so wonderful fudging of google task dates

commit 6478bb5
Author: Yu-Hung Lin <yuhung@yuhunglin.com>
Date:   Wed Dec 5 04:08:29 2012 -0800

    fixes

commit 1645939
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 18:32:09 2012 -0800

    CLC-696 In test, instantiating starting_date as a Time object should make the test pass even when the machine is in UTC

commit 0d88d47
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 18:00:33 2012 -0800

    CLC-696 Using Date.civil instead of Date.new may give us the right GMT timezone

commit 3f5f4c0
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 17:42:00 2012 -0800

    CLC-696 Add more log to determine_bucket method

commit 567fe4c
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 17:23:08 2012 -0800

    CLC-696 Increase log level another way

commit 48fe04a
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 16:53:34 2012 -0800

    CLC-696 Log more chattily so I can see what's going on

commit 5cc1499
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 16:37:04 2012 -0800

    CLC-696 Attempt to fix Travis test

commit 3762aeb
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 16:22:54 2012 -0800

    CLC-696 Fix test

commit 9064462
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 16:15:39 2012 -0800

    CLC-696 Get all the Canvas data into task feed, and test it

commit 25e30c3
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 11:36:15 2012 -0800

    CLC-696 Make some CanvasProxy tests part of testext

commit 53aaf91
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 09:46:38 2012 -0800

    CLC-696 Make MyTasks model more object oriented

commit 8326291
Author: Chris Tweney <chris@media.berkeley.edu>
Date:   Tue Dec 4 09:20:08 2012 -0800

    CLC-696 Add coming_up feed to Canvas proxy
e17e9d4
@shacker shacker referenced this pull request from a commit in shacker/calcentral
@shacker shacker CLC-909 Design refinements #2 5d7dd3e
@chikoon chikoon referenced this pull request from a commit in chikoon/calcentral
@chikoon chikoon CLC-3432: User alert feature can't handle diacriticals - PR #2
https://jira.ets.berkeley.edu/jira/browse/CLC-3432

Stopped using the magic header # encoding: utf-8
Stopped using Nokogiri for parsing the xml file since that's where the diacriticals were getting lost.
So, instead of using Nokogiri, I used the Hash.from_xml method which doesn't make a mess of the data encoding, namely UTF-8 which should be the standard encoding everywhere.
Updated specs to stop testing for Nokogiri parsing errors and replaced them with a test for detecting parsing errors that could be returned by Hash.from_xml.
Exceptions are muted and logged as errors.
9620b6d
@chikoon chikoon referenced this pull request from a commit in chikoon/calcentral
@chikoon chikoon CLC-3432: User alert feature can't handle diacriticals - PR #2
https://jira.ets.berkeley.edu/jira/browse/CLC-3432

Stopped using the magic header # encoding: utf-8
Stopped using Nokogiri for parsing the xml file since that's where the diacriticals were getting lost.
So, instead of using Nokogiri, I used the Hash.from_xml method which doesn't make a mess of the data encoding, namely UTF-8 which should be the standard encoding everywhere.
Updated specs to stop testing for Nokogiri parsing errors and replaced them with a test for detecting parsing errors that could be returned by Hash.from_xml.
Exceptions are muted and logged as errors.
c580f1a
@chikoon chikoon referenced this pull request from a commit in chikoon/calcentral
@chikoon chikoon CLC-3432: User alert feature can't handle diacriticals - PR #2
https://jira.ets.berkeley.edu/jira/browse/CLC-3432

Stopped using the magic header # encoding: utf-8
Stopped using Nokogiri for parsing the xml file since that's where the diacriticals were getting lost.
So, instead of using Nokogiri, I used the Hash.from_xml method which doesn't make a mess of the data encoding, namely UTF-8 which should be the standard encoding everywhere.
Updated specs to stop testing for Nokogiri parsing errors and replaced them with a test for detecting parsing errors that could be returned by Hash.from_xml.
Exceptions are muted and logged as errors.
afd6f4a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 4, 2012
  1. @raydavis
This page is out of date. Refresh to see the latest.
View
1  src/main/java/edu/berkeley/calcentral/daos/ClassPagesDao.java
@@ -26,6 +26,7 @@ public ClassPage getBaseClassPage(int year, String term, String courseID) {
+ " bci.TERM_YR || bci.TERM_CD || bci.COURSE_CNTL_NUM classid, " //ignoring course control num permissions issues for now.
+ " '' info_last_updated, "
+ " bci.COURSE_TITLE classtitle, "
+ + " bci.DEPT_NAME department, "
+ " bci.CATALOG_DESCRIPTION description "
+ " FROM BSPACE_COURSE_INFO_VW bci "
+ " WHERE bci.TERM_YR = :year AND bci.TERM_CD = :term AND bci.COURSE_CNTL_NUM = :courseID";
View
13 src/main/java/edu/berkeley/calcentral/domain/ClassPage.java
@@ -10,11 +10,12 @@
private String info_last_updated;
private ClassPageCourseInfo courseinfo;
private String classtitle;
+ private String department;
private String description;
- private List<ClassPageInstructor> instructors;
+ private List<ClassPageInstructor> instructors;
private List<ClassPageSchedule> schedule;
- private List<ClassPageSection> sections;
-
+ private List<ClassPageSection> sections;
+
public String getClassId() {
return classid;
}
@@ -27,6 +28,9 @@ public ClassPageCourseInfo getCourseinfo() {
public String getClasstitle() {
return classtitle;
}
+ public String getDepartment() {
+ return department;
+ }
public String getDescription() {
return description;
}
@@ -51,6 +55,9 @@ public void setCourseinfo(ClassPageCourseInfo courseinfo) {
public void setClasstitle(String classtitle) {
this.classtitle = classtitle;
}
+ public void setDepartment(String department) {
+ this.department = department;
+ }
public void setDescription(String description) {
this.description = description;
}
View
4 src/main/java/edu/berkeley/calcentral/services/ClassPagesService.java
@@ -45,7 +45,6 @@
@Produces({MediaType.APPLICATION_JSON})
@Path("{ccc}")
public Map<String, Object> getClassInfoMap(@PathParam("ccc") String ccc) {
-
ClassPage classPage;
Map<String, Object> returnObject = Maps.newHashMap();
try {
@@ -54,13 +53,14 @@
returnObject.put("info_last_updated", classPage.getInfo_last_updated());
returnObject.put("courseinfo", classPage.getCourseinfo());
returnObject.put("classtitle", classPage.getClasstitle());
+ returnObject.put("department", classPage.getDepartment());
returnObject.put("description", classPage.getDescription());
returnObject.put("instructors", classPage.getInstructors());
returnObject.put("schedule", classPage.getSchedule());
returnObject.put("sections", classPage.getSections());
} catch (Exception e) {
//TODO: Change this to use whatever final exception handling scheme, instead of swallowing the exception.
- LOGGER.error(Throwables.getStackTraceAsString(e));
+ LOGGER.error(e.getMessage(), e);
}
return returnObject;
}
View
35 src/test/java/edu/berkeley/calcentral/services/ClassPagesServiceTest.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Sakai Foundation (SF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The SF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+package edu.berkeley.calcentral.services;
+
+import edu.berkeley.calcentral.DatabaseAwareTest;
+import edu.berkeley.calcentral.domain.ClassPage;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class ClassPagesServiceTest extends DatabaseAwareTest {
+ @Autowired
+ private ClassPagesService classPagesService;
+
+ @Test
+ public void getDepartment() throws Exception {
+ ClassPage classPage = classPagesService.getClassInfo("2012D7308");
+ assertNotNull(classPage);
+ assertEquals("BIOLOGY", classPage.getDepartment());
+ }
+}
Something went wrong with that request. Please try again.