Oprava burzy v jidelnicekDen

This commit is contained in:
Matyáš Caras 2022-04-05 17:06:25 +02:00
parent 025975a5f8
commit d48eecac69
4 changed files with 13 additions and 9 deletions

View file

@ -1,3 +1,6 @@
## 0.1.0-alpha.8
- Opravit získávání URL z burzy v `jidelnicekDen`
- tridy.dart - Burza: ~~jidlo~~ --> __nazev__
## 0.1.0-alpha.7
- Nastavovat `prihlasen` na `false` v případě chyby i u `ziskejUzivatele`
- Vylepšení dokumentace

View file

@ -135,7 +135,6 @@ class Canteen {
if (res.headers['set-cookie']!.contains("remember-me=;")) {
return false; // špatné heslo
}
print(res.statusCode);
if (res.statusCode != 302) {
return Future.error("Chyba: ${res.body}");
}
@ -261,10 +260,11 @@ class Canteen {
.group(0)
.toString());
var jidla = <Jidlo>[];
var jidelnicek =
RegExp(r'(?<=<div class="jidWrapLeft">).+?(?=<br>)', dotAll: true)
.allMatches(res)
.toList();
var jidelnicek = RegExp(
r'((?<=<div class="jidWrapLeft">).+?do burzy)|((?<=<div class="jidWrapLeft">).+?(?=<br>))',
dotAll: true)
.allMatches(res)
.toList();
for (var obed in jidelnicek) {
// formátování do třídy
var o = obed
@ -487,7 +487,7 @@ class Canteen {
var jidlo = Burza(
den: datum,
varianta: varianta,
jidlo: nazev,
nazev: nazev,
pocet: pocet,
url: url);
burza.add(jidlo);

View file

@ -47,7 +47,7 @@ class Burza {
final String? url;
/// Název jídla
String jidlo;
String nazev;
/// Varianta
String? varianta;
@ -58,7 +58,7 @@ class Burza {
Burza(
{required this.den,
required this.url,
required this.jidlo,
required this.nazev,
required this.pocet,
this.varianta});
}

View file

@ -1,8 +1,9 @@
name: canteenlib
description: Library for communication with the czech canteen food ordering system iCanteen
version: 0.1.0-alpha.7
version: 0.1.0-alpha.8
repository: 'https://github.com/hernikplays/canteenlib'
issue_tracker: 'https://github.com/hernikplays/canteenlib/issues'
documentation: 'https://docs.hernikplays.cz'
environment:
sdk: '>=2.16.1 <3.0.0'