fix: změnit získávání názvu jídla a aktualizovat závislosti
This commit is contained in:
parent
94a5451052
commit
fa3f5d94a9
4 changed files with 18 additions and 17 deletions
|
@ -9,7 +9,7 @@ Výchozí verze, pro kterou aktuálně je knihovna tvořena, je **2.18.19**
|
|||
|
||||
| Provozovatel | Verze iCanteen | Funkční | Verze knihovny |
|
||||
|:--------------:|------------------|---------|----------------|
|
||||
| SŠTE Brno | iCanteen 2.18.19 | ✅ | 1.0.0 |
|
||||
| SŠTE Brno | iCanteen 2.18.19 | ✅ | 1.0.1 |
|
||||
| SPŠ Třebíč | iCanteen 2.10.25 | ❓ | 0.1.0-alpha |
|
||||
|
||||
Pokud chcete přispět s testem, otestujte tuto knihovnu na instanci iCanteen, kde, nejlépe legálně, máte přístup, a nahlašte své poznatky [zde](https://github.com/hernikplays/canteenlib/issues/new?assignees=hernikplays&labels=kompatibilita&template=hl--en--kompatibility.md&title=Kompatibilita%3A+)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import 'tridy.dart';
|
||||
|
@ -283,7 +285,6 @@ class Canteen {
|
|||
RegExp(r'(?<=<div class="jidWrapLeft">).+?((fa-clock))', dotAll: true)
|
||||
.allMatches(res)
|
||||
.toList();
|
||||
|
||||
for (var obed in jidelnicek) {
|
||||
// formátování do třídy
|
||||
var o = obed
|
||||
|
@ -304,13 +305,13 @@ class Canteen {
|
|||
|
||||
var cena =
|
||||
double.parse(cenaMatch!.group(0).toString().replaceAll(",", "."));
|
||||
var jidlaProDen = RegExp(r'(?<=Polévka: ).+')
|
||||
.firstMatch(o)!
|
||||
.group(0)
|
||||
.toString()
|
||||
.replaceAll(' ,', ",")
|
||||
.replaceAll(" <br>", "")
|
||||
.split(" / ");
|
||||
var jidlaProDen =
|
||||
RegExp(r'<div class="jidWrapCenter.+?>(.+?)(?=<\/div>)', dotAll: true)
|
||||
.firstMatch(o)!
|
||||
.group(1)
|
||||
.toString()
|
||||
.replaceAll(' ,', ",")
|
||||
.replaceAll(" <br>", "");
|
||||
var vydejna = RegExp(
|
||||
r'(?<=<span class="smallBoldTitle button-link-align">).+?(?=<)')
|
||||
.firstMatch(o)!
|
||||
|
@ -336,8 +337,8 @@ class Canteen {
|
|||
}
|
||||
|
||||
jidla.add(Jidlo(
|
||||
nazev: jidlaProDen[1]
|
||||
.replaceAll(r' (?=[^a-zA-ZěščřžýáíéĚŠČŘŽÝÁÍÉŤŇťň])', ''),
|
||||
nazev: jidlaProDen.replaceAll(
|
||||
r' (?=[^a-zA-ZěščřžýáíéĚŠČŘŽÝÁÍÉŤŇťň])', ''),
|
||||
objednano: objednano,
|
||||
varianta: vydejna,
|
||||
lzeObjednat: lzeObjednat,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: canteenlib
|
||||
description: Library for communication with the czech canteen food ordering system iCanteen
|
||||
version: 1.0.0
|
||||
version: 1.0.1
|
||||
repository: 'https://github.com/hernikplays/canteenlib'
|
||||
issue_tracker: 'https://github.com/hernikplays/canteenlib/issues'
|
||||
documentation: 'https://docs.hernikplays.cz'
|
||||
|
@ -9,8 +9,8 @@ environment:
|
|||
sdk: '>=2.16.1 <3.0.0'
|
||||
|
||||
dev_dependencies:
|
||||
dotenv: ^3.0.0
|
||||
lints: ^1.0.0
|
||||
dotenv: ^4.0.1
|
||||
lints: ^2.0.0
|
||||
test: ^1.16.0
|
||||
dependencies:
|
||||
http: ^0.13.4
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import 'package:canteenlib/canteenlib.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:dotenv/dotenv.dart' show load, env;
|
||||
import 'package:dotenv/dotenv.dart';
|
||||
|
||||
void main() {
|
||||
group('A group of tests', () {
|
||||
load();
|
||||
var env = DotEnv(includePlatformEnvironment: true)..load();
|
||||
Canteen c = Canteen(env["ADDRESS"]!);
|
||||
|
||||
test('Log-in test', () {
|
||||
|
@ -21,7 +21,7 @@ void main() {
|
|||
|
||||
test('Neprázdný jídelníček', () {
|
||||
c.login(env["USER"]!, env["PASS"]!).then((r) {
|
||||
c.jidelnicekDen(den: DateTime.parse("2022-08-15")).then((t) {
|
||||
c.jidelnicekDen(den: DateTime.now().add(Duration(days: 5))).then((t) {
|
||||
print(t.jidla[0].nazev);
|
||||
expect(t.jidla[0].nazev.isNotEmpty, true);
|
||||
});
|
||||
|
|
Reference in a new issue