Compare commits

..

No commits in common. "359cd64dc6e2f03059c53c147d298a964e83a63f" and "eb13ce2e412859fb9601ec19538504495457c4a9" have entirely different histories.

3 changed files with 8 additions and 13 deletions

View file

@ -1,5 +1,3 @@
## 1.1.2
- Opravit negativní čísla v kreditu, účet pro platby by @tpkowastaken in https://github.com/hernikplays/canteenlib/pull/4
## 1.1.1
- Opravit problém s burzou
## 1.1.0-alpha.1

View file

@ -48,19 +48,17 @@ class Canteen {
prihlasen = false;
return Future.error("Uživatel není přihlášen");
}
var kreditMatch = double.tryParse(RegExp(r' +<span id="Kredit" .+?>(.+?)(?=&)')
var m = double.tryParse(RegExp(r' +<span id="Kredit" .+?>(.+?)(?=&)')
.firstMatch(r)!
.group(1)!
.replaceAll(",", ".")
.replaceAll(RegExp(r"[^\w.-]"), ""));
.replaceAll(RegExp(r"[^\w.]"), ""));
var jmenoMatch = RegExp(r'(?<=jméno: <b>).+?(?=<\/b)').firstMatch(r);
var prijmeniMatch = RegExp(r'(?<=příjmení: <b>).+?(?=<\/b)').firstMatch(r);
var kategorieMatch =
RegExp(r'(?<=kategorie: <b>).+?(?=<\/b)').firstMatch(r);
var ucetMatch = RegExp(r'účet pro platby do jídelny:\s*<b>(\d+/\d+)</b>')
.firstMatch(r)
?.group(1)
?.replaceAll(RegExp(r'<\/?b>'), '');//odstranit html tag <b>
var ucetMatch = RegExp(r'(?<=účet pro platby do jídelny: <b>).+?(?=<\/b)')
.firstMatch(r);
var varMatch =
RegExp(r'(?<=variabilní symbol: <b>).+?(?=<\/b)').firstMatch(r);
var specMatch =
@ -69,10 +67,9 @@ class Canteen {
var jmeno = jmenoMatch?.group(0) ?? "";
var prijmeni = prijmeniMatch?.group(0) ?? "";
var kategorie = kategorieMatch?.group(0) ?? "";
var ucet = ucetMatch ?? "";
var ucet = ucetMatch?.group(0) ?? "";
var varSymbol = varMatch?.group(0) ?? "";
var specSymbol = specMatch?.group(0) ?? "";
var kredit = kreditMatch ?? 0.0;
return Uzivatel(
jmeno: jmeno,
@ -81,7 +78,7 @@ class Canteen {
ucetProPlatby: ucet,
varSymbol: varSymbol,
specSymbol: specSymbol,
kredit: kredit);
kredit: m ?? 0.0);
}
Future<void> _getFirstSession() async {

View file

@ -1,11 +1,11 @@
name: canteenlib
description: Library for communication with the czech canteen food ordering system iCanteen
version: 1.1.2
version: 1.1.1
repository: 'https://git.mnau.xyz/hernik/canteenlib'
issue_tracker: 'https://git.mnau.xyz/hernik/canteenlib/issues'
environment:
sdk: '>=2.16.1 <4.0.0'
sdk: '>=2.16.1 <3.0.0'
dev_dependencies:
dotenv: ^4.0.1