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 ## 0.1.0-alpha.7
- Nastavovat `prihlasen` na `false` v případě chyby i u `ziskejUzivatele` - Nastavovat `prihlasen` na `false` v případě chyby i u `ziskejUzivatele`
- Vylepšení dokumentace - Vylepšení dokumentace

View file

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

View file

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

View file

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