Skip to content

Commit

Permalink
Rewrite rank node filter
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Lu-none committed Sep 6, 2023
1 parent 42cf15f commit ca584f8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/src/connector/score_connector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,9 @@ class ScoreConnector {
result = await Connector.getDataByGet(parameter);
tagNode = parse(result);
rankNodes = tagNode.getElementsByTagName("tbody")[0].getElementsByTagName("tr");
final List<Element> filteredRankNodes = [];
for (final rankNode in rankNodes) {
if (rankNode.getElementsByTagName("td").length < 7) continue;
filteredRankNodes.add(rankNode);
}
final filteredRankNodes =
rankNodes.where((node) => node.getElementsByTagName("td").length >= 7).toList().reversed.toList();
rankNodes = filteredRankNodes;
rankNodes = rankNodes.toList().reversed.toList();
for (int i = 0; i < (rankNodes.length / 3).floor(); i++) {
SemesterJson semester = SemesterJson();
String semesterString = rankNodes[i * 3 + 2].getElementsByTagName("td")[0].innerHtml.split("<br>").first;
Expand Down

0 comments on commit ca584f8

Please sign in to comment.