Race clock now works and the setup for the racestart now checks if the tag has "Start" or "Time". #story[782]
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package seng302.Mock;
|
||||
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
import org.joda.time.DateTime;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
@@ -71,20 +72,22 @@ public class StreamedCourseXMLReader extends XMLReader {
|
||||
}
|
||||
|
||||
private void read() throws ParseException, StreamedCourseXMLException {
|
||||
// readRace();
|
||||
readRace();
|
||||
readParticipants();
|
||||
readCourse();
|
||||
}
|
||||
|
||||
private void readRace() throws ParseException {
|
||||
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssZ");
|
||||
DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
Element settings = (Element) doc.getElementsByTagName("Race").item(0);
|
||||
|
||||
System.out.println(getTextValueOfNode(settings, "CreationTimeDate"));
|
||||
raceID = Integer.parseInt(getTextValueOfNode(settings, "RaceID"));
|
||||
raceType = getTextValueOfNode(settings, "RaceType");
|
||||
creationTimeDate = ZonedDateTime.parse(getTextValueOfNode(settings, "CreationTimeDate"), dateFormat);
|
||||
NamedNodeMap raceTimeTag = doc.getElementsByTagName("RaceStartTime").item(0).getAttributes();
|
||||
raceStartTime = ZonedDateTime.parse(raceTimeTag.getNamedItem("Time").getTextContent(), dateFormat);
|
||||
if (raceTimeTag.getNamedItem("Time") != null) raceStartTime = ZonedDateTime.parse(raceTimeTag.getNamedItem("Time").getTextContent(), dateFormat);
|
||||
else raceStartTime = ZonedDateTime.parse(raceTimeTag.getNamedItem("Start").getTextContent(), dateFormat);
|
||||
postpone = Boolean.parseBoolean(raceTimeTag.getNamedItem("Postpone").getTextContent());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user