Skip to content

Commit

Permalink
Fix fees parser when no limit
Browse files Browse the repository at this point in the history
  • Loading branch information
bdmendes committed Jul 30, 2023
1 parent 948b16c commit a15e3f1
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions uni/lib/controller/parsers/parser_fees.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@ String parseFeesBalance(http.Response response) {
/// If there are no due payments, `Sem data` is returned.
DateTime? parseFeesNextLimit(http.Response response) {
final document = parse(response.body);

final lines = document.querySelectorAll('#tab0 .tabela tr');

if (lines.length < 2) {
try {
final limit = lines[1].querySelectorAll('.data')[0].text;
return DateTime.parse(limit);
} catch (_) {
return null;
}

final limit = lines[1].querySelectorAll('.data')[1].text;

// It's completely fine to throw an exception if it fails, in this case,
// since probably Sigarra is returning something we don't except
return DateTime.parse(limit);
}

0 comments on commit a15e3f1

Please sign in to comment.