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 |
|
| 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 |
|
| 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+)
|
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 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import 'tridy.dart';
|
import 'tridy.dart';
|
||||||
|
@ -283,7 +285,6 @@ class Canteen {
|
||||||
RegExp(r'(?<=<div class="jidWrapLeft">).+?((fa-clock))', dotAll: true)
|
RegExp(r'(?<=<div class="jidWrapLeft">).+?((fa-clock))', dotAll: true)
|
||||||
.allMatches(res)
|
.allMatches(res)
|
||||||
.toList();
|
.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
|
||||||
|
@ -304,13 +305,13 @@ class Canteen {
|
||||||
|
|
||||||
var cena =
|
var cena =
|
||||||
double.parse(cenaMatch!.group(0).toString().replaceAll(",", "."));
|
double.parse(cenaMatch!.group(0).toString().replaceAll(",", "."));
|
||||||
var jidlaProDen = RegExp(r'(?<=Polévka: ).+')
|
var jidlaProDen =
|
||||||
.firstMatch(o)!
|
RegExp(r'<div class="jidWrapCenter.+?>(.+?)(?=<\/div>)', dotAll: true)
|
||||||
.group(0)
|
.firstMatch(o)!
|
||||||
.toString()
|
.group(1)
|
||||||
.replaceAll(' ,', ",")
|
.toString()
|
||||||
.replaceAll(" <br>", "")
|
.replaceAll(' ,', ",")
|
||||||
.split(" / ");
|
.replaceAll(" <br>", "");
|
||||||
var vydejna = RegExp(
|
var vydejna = RegExp(
|
||||||
r'(?<=<span class="smallBoldTitle button-link-align">).+?(?=<)')
|
r'(?<=<span class="smallBoldTitle button-link-align">).+?(?=<)')
|
||||||
.firstMatch(o)!
|
.firstMatch(o)!
|
||||||
|
@ -336,8 +337,8 @@ class Canteen {
|
||||||
}
|
}
|
||||||
|
|
||||||
jidla.add(Jidlo(
|
jidla.add(Jidlo(
|
||||||
nazev: jidlaProDen[1]
|
nazev: jidlaProDen.replaceAll(
|
||||||
.replaceAll(r' (?=[^a-zA-ZěščřžýáíéĚŠČŘŽÝÁÍÉŤŇťň])', ''),
|
r' (?=[^a-zA-ZěščřžýáíéĚŠČŘŽÝÁÍÉŤŇťň])', ''),
|
||||||
objednano: objednano,
|
objednano: objednano,
|
||||||
varianta: vydejna,
|
varianta: vydejna,
|
||||||
lzeObjednat: lzeObjednat,
|
lzeObjednat: lzeObjednat,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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: 1.0.0
|
version: 1.0.1
|
||||||
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'
|
documentation: 'https://docs.hernikplays.cz'
|
||||||
|
@ -9,8 +9,8 @@ environment:
|
||||||
sdk: '>=2.16.1 <3.0.0'
|
sdk: '>=2.16.1 <3.0.0'
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
dotenv: ^3.0.0
|
dotenv: ^4.0.1
|
||||||
lints: ^1.0.0
|
lints: ^2.0.0
|
||||||
test: ^1.16.0
|
test: ^1.16.0
|
||||||
dependencies:
|
dependencies:
|
||||||
http: ^0.13.4
|
http: ^0.13.4
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import 'package:canteenlib/canteenlib.dart';
|
import 'package:canteenlib/canteenlib.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
import 'package:dotenv/dotenv.dart' show load, env;
|
import 'package:dotenv/dotenv.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
group('A group of tests', () {
|
group('A group of tests', () {
|
||||||
load();
|
var env = DotEnv(includePlatformEnvironment: true)..load();
|
||||||
Canteen c = Canteen(env["ADDRESS"]!);
|
Canteen c = Canteen(env["ADDRESS"]!);
|
||||||
|
|
||||||
test('Log-in test', () {
|
test('Log-in test', () {
|
||||||
|
@ -21,7 +21,7 @@ void main() {
|
||||||
|
|
||||||
test('Neprázdný jídelníček', () {
|
test('Neprázdný jídelníček', () {
|
||||||
c.login(env["USER"]!, env["PASS"]!).then((r) {
|
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);
|
print(t.jidla[0].nazev);
|
||||||
expect(t.jidla[0].nazev.isNotEmpty, true);
|
expect(t.jidla[0].nazev.isNotEmpty, true);
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue