1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-09-19 20:29:08 -05:00

Fix parsing grade description with symbol containing special chars (#104)

This commit is contained in:
Mikołaj Pich 2018-05-11 21:55:38 +02:00 committed by Rafał Borcz
parent 3105e9e53b
commit be8ee4c835
4 changed files with 14 additions and 2 deletions

View File

@ -227,5 +227,7 @@ workflows:
requires:
- instrumented
filters:
branches:
only: master
tags:
only: /.*/

View File

@ -56,7 +56,7 @@ public class GradesList {
String descriptions = row.select("td:nth-child(3)").text();
String symbol = descriptions.split(", ")[0];
String description = descriptions.replaceFirst(symbol, "").replaceFirst(", ", "");
String description = descriptions.replaceFirst(Pattern.quote(symbol), "").replaceFirst(", ", "");
String color = getColor(row.select("td:nth-child(2) span.ocenaCzastkowa").attr("style"));
String date = formatDate(row.select("td:nth-child(5)").text());

View File

@ -19,7 +19,7 @@ public class GradesListTest extends StudentAndParentTestCase {
@Test
public void getAllTest() throws Exception {
Assert.assertEquals(6, filled.getAll().size()); // 2 items are skipped
Assert.assertEquals(7, filled.getAll().size()); // 2 items are skipped
}
@Test
@ -60,6 +60,7 @@ public class GradesListTest extends StudentAndParentTestCase {
Assert.assertEquals("BW3", list.get(3).getSymbol());
Assert.assertEquals("STR", list.get(4).getSymbol());
Assert.assertEquals("K", list.get(5).getSymbol());
Assert.assertEquals("+Odp", list.get(6).getSymbol());
}
@Test
@ -70,6 +71,7 @@ public class GradesListTest extends StudentAndParentTestCase {
Assert.assertEquals("Writing", list.get(3).getDescription());
Assert.assertEquals("", list.get(4).getDescription());
Assert.assertEquals("Kordian", list.get(5).getDescription());
Assert.assertEquals("Kordian", list.get(6).getDescription());
}
@Test

View File

@ -100,6 +100,14 @@
<td>06.02.2017</td>
<td>Amelia Stępień</td>
</tr>
<tr>
<td>Język polski</td>
<td class="break-word"><span class="ocenaCzastkowa" style="color:#6ECD07;">5</span></td>
<td class="break-word">+Odp, Kordian</td>
<td>5,00</td>
<td>11.05.2017</td>
<td>Amelia Stępień</td>
</tr>
</tbody>
</table>
</main>