Commit 326e7a8d authored by Koen van der Veen's avatar Koen van der Veen
Browse files

fix duplicates

parent 3e3bf824
Pipeline #9835 failed with stages
in 1 minute and 10 seconds
Showing with 17 additions and 10 deletions
+17 -10
......@@ -198,13 +198,20 @@ query {
else if (properties.contains('postDate')){
sorter = 'order_desc: postDate,';
}
return await getResultAsItemList(query: '''
List<Item> res = await getResultAsItemList(query: '''
query {
$type($sorter limit: $amount) {
$type($sorter, filter: {deleted: {eq: 0}}) {
${properties.join('\n')}
isMock
}
}
''');
//ugly hack to make sure we can filter and limit
res = res.where((x) => x.get('isMock') != true).toList();
if (res.length > amount){
res = res.sublist(0, amount);
}
return res;
}
Future<List<Item>> loadAppContent(String pluginId, String dataType, List<String> properties) async {
......
......@@ -357,7 +357,7 @@ class DataAppProvider with ChangeNotifier {
}
newItems.add(newItem);
}
AppLogger.debug(newItems);
// AppLogger.debug(newItems);
await _podService.bulkAction(createItems: newItems);
AppLogger.debug('Created ${newItems.length} new mock messages');
......@@ -416,10 +416,10 @@ class DataAppProvider with ChangeNotifier {
notifyListeners();
}
handleOpenDataApp(BuildContext context, Item plugin, AppState appState) {
handleOpenDataApp(BuildContext context, Item plugin, AppState appState) async {
var pluginId = plugin.get('id');
if (!runningPlugins.containsKey(pluginId)) {
runDataAppPlugin(plugin);
await runDataAppPlugin(plugin);
} else {
AppLogger.debug('Already running');
}
......@@ -429,7 +429,7 @@ class DataAppProvider with ChangeNotifier {
param: {'id': pluginId, 'tab': appState.toUrlString()});
}
runDataAppPlugin(Item plugin) {
runDataAppPlugin(Item plugin) async {
AppLogger.debug('Creating pluginRun: ${plugin.get("name")}');
Item pluginRun = Item(type: 'PluginRun');
plugin.properties.forEach((key, value) {
......@@ -448,7 +448,7 @@ class DataAppProvider with ChangeNotifier {
pluginRun.properties['config'] = jsonEncode(config);
currentDataType = plugin.get('dataType');
createMockItems(128, plugin.get('id'));
await createMockItems(128, plugin.get('id'));
_podService.createItem(item: pluginRun);
AppLogger.debug("created PluginRun ${pluginRun.get("id")}");
......@@ -843,7 +843,7 @@ class DataAppProvider with ChangeNotifier {
// set items if we already ran the plugin in the past
currentPluginItems =
await loadAppContent('_preview-$currentGitProjectId', currentDataType!);
print('initial items');
print(currentPluginItems);
// print('initial items');
// print(currentPluginItems);
}
}
......@@ -85,7 +85,7 @@ class _DataAppState extends State<DataApp> {
loadAppContent() async {
contentHasLoaded = false;
appContent = await _dataAppProvider.loadAppContent(widget.pluginId, 'Tweet');
appContent = await _dataAppProvider.loadAppContent(widget.pluginId, 'Tweet', onlyWithPredictions: false);
contentHasLoaded = true;
setState(() {});
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment