Skip to content

Commit

Permalink
Merge pull request #44 from Blawx/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauntlet173 authored Jun 6, 2020
2 parents c741bfc + 5373d47 commit 8de5117
Show file tree
Hide file tree
Showing 7 changed files with 216 additions and 52 deletions.
23 changes: 18 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
As of v0.2-alpha, this project is attempting to adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
While alpha, however, any version changes may cause breaking changes that may not be specifically noted as such.

## [v0.2.1-alpha] 2020-05-26
## Unreleased
### Added
* Script for updating running container in development enviroments.
* Start of gh-pages based documentation
### Changed
* Implemented custom true/false value block ([Issue #8](https://github.com/Blawx/blawx/issues/8))
**Note that this may be a breaking change for people using the docassemble-blawx integration.**
* Changes to what counts as conflicting results for the purpose of override blocks, only applies
to workspaces using the new true/false blocks.
### Fixed
* Docker install missing sudo.
* Docker install missing python3. ([Issue #38](https://github.com/Blawx/blawx/issues/38))
* Overridden answers still returned. ([Issue #2](https://github.com/Blawx/blawx/issues/2))
* Aggregate functions not working. ([Issue #19](https://github.com/Blawx/blawx/Issues/19))

## [v0.2.1-alpha](https://github.com/Blawx/blawx/releases/tag/v0.2.1-alpha) 2020-05-26
### Added
* Dockerized install process ([Issue #21](https://github.com/Blawx/blawx/issues/21))
* Calculation Block ([Issue #20](https://github.com/Blawx/blawx/issues/20))
Expand All @@ -15,11 +30,9 @@ While alpha, however, any version changes may cause breaking changes that may no
* Remove extra implication operators ([Issue #16](https://github.com/Blawx/blawx/issues/16))
* Math operators and aggregate functions now report "Number" as their output type.

## [v0.2-alpha] 2020-05-22
## [v0.2-alpha](https://github.com/Blawx/blawx/releases/tag/v0.2-alpha) 2020-05-22
### Changed
* Installation process clarified, simplified. ([Issue #9](https://github.com/Blawx/blawx/issues/9))
### Fixed
* Reasoner was crashing on machines with slower processors. ([Issue #25](https://github.com/Blawx/blawx/issues/25))
* Reasoner was crashing on machines with slower processors. ([Issue #25](https://github.com/Blawx/blawx/issues/25))ff

[v0.2-alpha](https://github.com/Blawx/blawx/releases/tag/v0.2-alpha)
[v0.2.1-alpha](https://github.com/Blawx/blawx/releases/tag/v0.2.1-alpha)
21 changes: 13 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get -y update && \
apt-get install -y \
sudo \
python3 \
git \
wget \
apache2 \
Expand All @@ -26,14 +28,7 @@ RUN echo "www-data ALL=(root) NOPASSWD: /var/Flora-2/flora2/runflora" >> /etc/su
WORKDIR /var/www/html

RUN git clone https://github.com/google/blockly blockly && \
cp -r ./blockly/media ./media && \
git clone -b dev https://github.com/Blawx/blawx blawx && \
cd blawx/interface && \
cp * /var/www/html && \
cd ../reasoner && \
cp reasoner.php /usr/lib/cgi-bin && \
cp decode.js /var/www/html && \
cp json2f2.py /var/www/html
cp -r ./blockly/media ./media

WORKDIR /var

Expand All @@ -43,4 +38,14 @@ RUN wget -O flora2.run \

CMD ["apachectl", "-D", "FOREGROUND"]

WORKDIR /var/www/html

COPY . ./blawx

COPY interface .

COPY reasoner/decode.js reasoner/json2f2.py ./

COPY reasoner/reasoner.php /usr/lib/cgi-bin

EXPOSE 80
41 changes: 36 additions & 5 deletions interface/blawx-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,23 +599,23 @@ Blockly.Blocks['declare_type'] = {
],
[
"distinct count",
"distinctcount"
"countdistinct"
],
[
"average",
"average"
"avg"
],
[
"distinct average",
"distinctaverage"
"avgdistinct"
],
[
"sum",
"sum"
],
[
"distinct sum",
"distinctsum"
"sumdistinct"
]
]
},
Expand All @@ -626,7 +626,7 @@ Blockly.Blocks['declare_type'] = {
},
{
"type": "input_statement",
"name": "NAME"
"name": "aggregate_conditions"
}
],
"inputsInline": true,
Expand Down Expand Up @@ -983,4 +983,35 @@ Blockly.Blocks['calculation'] = {
}
)
}
}

Blockly.Blocks['boolean_value'] = {
init: function() {
this.jsonInit(
{
"type": "boolean_value",
"message0": "%1",
"args0": [
{
"type": "field_dropdown",
"name": "value",
"options": [
[
"true",
"true"
],
[
"false",
"false"
]
]
}
],
"output": "Boolean",
"colour": 195,
"tooltip": "Returns either true or false.",
"helpUrl": ""
}
)
}
}
4 changes: 2 additions & 2 deletions interface/blawx.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@
</category>
<category name="Values" colour="#5ba5a5">
<category name="True or False">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
<block type="boolean_value">
<field name="value">true</field>
</block>
</category>
<category name="Numbers">
Expand Down
57 changes: 50 additions & 7 deletions reasoner/decode.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,23 +601,23 @@ Blockly.Blocks['declare_type'] = {
],
[
"distinct count",
"distinctcount"
"countdistinct"
],
[
"average",
"average"
"avg"
],
[
"distinct average",
"distinctaverage"
"avgdistinct"
],
[
"sum",
"sum"
],
[
"distinct sum",
"distinctsum"
"sumdistinct"
]
]
},
Expand All @@ -628,7 +628,7 @@ Blockly.Blocks['declare_type'] = {
},
{
"type": "input_statement",
"name": "NAME"
"name": "aggregate_conditions"
}
],
"inputsInline": true,
Expand Down Expand Up @@ -987,6 +987,37 @@ Blockly.Blocks['calculation'] = {
}
}

Blockly.Blocks['boolean_value'] = {
init: function() {
this.jsonInit(
{
"type": "boolean_value",
"message0": "%1",
"args0": [
{
"type": "field_dropdown",
"name": "value",
"options": [
[
"true",
"true"
],
[
"false",
"false"
]
]
}
],
"output": "Boolean",
"colour": 195,
"tooltip": "Returns either true or false.",
"helpUrl": ""
}
)
}
}

Blockly.JavaScript['declare_type'] = function(block) {
var text_type_name = block.getFieldValue('type_name');
var code = text_type_name + '::Thing';
Expand Down Expand Up @@ -1018,7 +1049,7 @@ Blockly.Blocks['calculation'] = {
var statements_conclusion = Blockly.JavaScript.statementToCode(block, 'conclusion');
var code = "";
if (text_rule_name) {
code += '@!{' + text_rule_name.replace(/ /g,"_") + "}\n";
code += '@{' + text_rule_name.replace(/ /g,"_") + "}\n";
}
var currentBlock = this.getInputTargetBlock('conclusion');
while (currentBlock) {
Expand Down Expand Up @@ -1289,7 +1320,7 @@ Blockly.Blocks['calculation'] = {
Blockly.JavaScript['aggregate_statement'] = function(block) {
var dropdown_aggregation_operation = block.getFieldValue('aggregation_operation');
var value_aggregate_variable = Blockly.JavaScript.valueToCode(block, 'aggregate_variable', Blockly.JavaScript.ORDER_ATOMIC);
var statements_aggregate_conditions = Blockly.JavaScript.statementToCode(block, 'aggregate_conditions');
//var statements_aggregate_conditions = Blockly.JavaScript.statementToCode(block, 'aggregate_conditions');
var code = dropdown_aggregation_operation + '{' + value_aggregate_variable + '|';
var currentBlock = this.getInputTargetBlock('aggregate_conditions');
while (currentBlock) {
Expand Down Expand Up @@ -1397,6 +1428,18 @@ Blockly.Blocks['calculation'] = {
var code = value_variable + " \\is " + value_calculation;
return code;
};

Blockly.JavaScript['boolean_value'] = function(block) {
var dropdown_value = block.getFieldValue('value');
var code = "";
if (dropdown_value == "true") {
code = "\\true";
}
if (dropdown_value == "false") {
code = "\\false";
}
return [code, Blockly.JavaScript.ORDER_ATOMIC];
};

/**
* Generate code for the specified block but not following blocks.
Expand Down
Loading

0 comments on commit 8de5117

Please sign in to comment.