allow duplicates in database, and start of web server
This commit is contained in:
parent
0a558ed68d
commit
7f49500db8
5 changed files with 28 additions and 8 deletions
7
Makefile
7
Makefile
|
|
@ -35,6 +35,13 @@ build-linux-debug-container:
|
||||||
build-web-debug-container:
|
build-web-debug-container:
|
||||||
$(FLUTTERW) build web --debug
|
$(FLUTTERW) build web --debug
|
||||||
|
|
||||||
|
# Zip web build for embedding as asset
|
||||||
|
assets/generated/webapp.zip: build/web
|
||||||
|
mkdir -p assets/generated
|
||||||
|
cd build/web && zip -r ../../assets/generated/webapp.zip .
|
||||||
|
|
||||||
|
build-webapp-zip: assets/generated/webapp.zip
|
||||||
|
|
||||||
run-linux-debug-container:
|
run-linux-debug-container:
|
||||||
$(FLUTTERW) run -d linux
|
$(FLUTTERW) run -d linux
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -245,13 +245,6 @@ class Corpus{
|
||||||
loadFormulas(formulas, replaceOnDuplicates: replaceOnDuplicates, checkUnits: true);
|
loadFormulas(formulas, replaceOnDuplicates: replaceOnDuplicates, checkUnits: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Loads corpus from database elements
|
|
||||||
static Future<Corpus> fromDatabaseElements(List<FormulaElement> elements) async {
|
|
||||||
final corpus = Corpus();
|
|
||||||
corpus.loadFormulaElements(elements);
|
|
||||||
return corpus;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the formula, the units of the formula, and all the units from the corpus with the same base unit.
|
/// Returns the formula, the units of the formula, and all the units from the corpus with the same base unit.
|
||||||
List<FormulaElement> withDependencies(Formula formula) {
|
List<FormulaElement> withDependencies(Formula formula) {
|
||||||
final result = <FormulaElement>{};
|
final result = <FormulaElement>{};
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,9 @@ Future<Corpus> loadCorpusFromDatabaseOrAssets() async {
|
||||||
return defaultCorpus;
|
return defaultCorpus;
|
||||||
} else {
|
} else {
|
||||||
// Load corpus from database elements
|
// Load corpus from database elements
|
||||||
return await Corpus.fromDatabaseElements(dbElements);
|
final corpus = Corpus();
|
||||||
|
corpus.loadFormulaElements(dbElements, true);
|
||||||
|
return corpus;
|
||||||
}
|
}
|
||||||
} catch (e, st) {
|
} catch (e, st) {
|
||||||
// If there's an error loading from database, fall back to default corpus
|
// If there's an error loading from database, fall back to default corpus
|
||||||
|
|
|
||||||
16
pubspec.lock
16
pubspec.lock
|
|
@ -17,6 +17,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.4.1"
|
version: "8.4.1"
|
||||||
|
archive:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: archive
|
||||||
|
sha256: a96e8b390886ee8abb49b7bd3ac8df6f451c621619f52a26e815fdcf568959ff
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.9"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
@ -688,6 +696,14 @@ packages:
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.5.2"
|
version: "1.5.2"
|
||||||
|
posix:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: posix
|
||||||
|
sha256: "185ef7606574f789b40f289c233efa52e96dead518aed988e040a10737febb07"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "6.5.0"
|
||||||
provider:
|
provider:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ dependencies:
|
||||||
collection:
|
collection:
|
||||||
share_plus:
|
share_plus:
|
||||||
receive_sharing_intent:
|
receive_sharing_intent:
|
||||||
|
archive: ^4.0.9
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
@ -88,6 +89,7 @@ flutter:
|
||||||
assets:
|
assets:
|
||||||
- assets/units/
|
- assets/units/
|
||||||
- assets/formulas/
|
- assets/formulas/
|
||||||
|
- assets/generated/webapp.zip
|
||||||
|
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
# An image asset can refer to one or more resolution-specific "variants", see
|
||||||
# https://flutter.dev/to/resolution-aware-images
|
# https://flutter.dev/to/resolution-aware-images
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue