Skip to content

Commit

Permalink
Merge pull request #3295 from CityOfBoston/master
Browse files Browse the repository at this point in the history
(stage) ModState Log Update, MNL Update, Drupal Maintenanc
  • Loading branch information
davidrkupton authored Jan 11, 2024
2 parents 1179d5f + 178cfd6 commit df4ba62
Show file tree
Hide file tree
Showing 18 changed files with 1,562 additions and 567 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@
"drupal/console-extend-plugin": false,
"oomphinc/composer-installers-extender": true,
"simplesamlphp/composer-module-installer": false,
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"php-http/discovery": true
}
},
"autoload": {
Expand Down
1,813 changes: 1,326 additions & 487 deletions composer.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public function assessingDetails($parcel_id) {
$statement6 = "SELECT owner_name FROM current_owners WHERE parcel_id = '$parcel_id'";

$sql = new SQL();
$bearer_token = $sql->getToken("assessing")[0];
$connection_token = $sql->getToken("assessing")[1];
$bearer_token = $sql->getToken("assessing")["bearer_token"];
$connection_token = $sql->getToken("assessing")["connection_token"];

$sqlQuery_main = $sql->runQuery($bearer_token,$connection_token,$statement1);
$sqlQuery_res = $sql->runQuery($bearer_token,$connection_token,$statement2);
Expand All @@ -79,7 +79,7 @@ public function assessingDetails($parcel_id) {

$coords = $this->getPolyCoords($parcel_id);
$fiscal_year = ( date('m') > 6) ? intval(date('Y')) + 1 : date('Y');

return [
'#theme' => 'bos_assessing',
'#data_full' => $sqlQuery_main,
Expand All @@ -103,8 +103,8 @@ public function assessingLookup() {
$sql = new SQL();

//required
$bearer_token = $sql->getToken("assessing")[0];
$connection_token = $sql->getToken("assessing")[1];
$bearer_token = $sql->getToken("assessing")["bearer_token"];
$connection_token = $sql->getToken("assessing")["connection_token"];

$table = "taxbill";
$filter = [];
Expand Down Expand Up @@ -136,7 +136,7 @@ public function assessingLookup() {
$page = ($data->get("page")) ? $data->get("page") : null;
$fields = ($data->get("fields")) ? $data->get("fields") : null;

return $sql->runSelect($bearer_token,$connection_token,$table,$filter,$sort,$limit,$page,$fields);
return $sql->runSelect($bearer_token, $connection_token, $table, $fields, $filter, $sort, $limit, $page);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,20 @@ protected function fetchDBData($type):array {
$count = 0;
while (!$tokens = $sql->getToken("assessing")) {
$count++;
if ($count >= 10) {
if ($count <= 10) {
sleep(10);
}
}
$statement = "SELECT * FROM dbo.taxbill WHERE parcel_id = '{$this->id}'";
$count = 0;
while (!$map = $sql->runQuery($tokens[0], $tokens[1], $statement)) {
// $statement = "SELECT * FROM dbo.taxbill WHERE parcel_id = '{$this->id}'";
// while (!$map = $sql->runQuery($tokens["bearer_token"], $tokens["connection_token"], $statement)) {
while (!$map = $sql->runSelect($tokens["bearer_token"], $tokens["connection_token"], "taxbill", NULL, [["parcel_id" => $this->id]])) {
$count++;
if ($count >= 10) {
if ($count <= 10) {
sleep(10);
}
}
$map = (array) $map[0];
$map = (array) json_decode($map->getContent())[0];
// Make sure the parcel_id is the expected parcel id
if ($map["parcel_id"] != $this->id) {
throw new \Exception("Data error - unexpected pacel_id");
Expand All @@ -223,7 +224,7 @@ protected function fetchDBData($type):array {
$map["ward"] = preg_replace("~(.)(.)~", "$1 $2 $3 $4 $5", substr($map["parcel_id"], 0, 2));
$map["parcel-0"] = preg_replace("~(.)(.)(.)(.)(.)~", "$1 $2 $3 $4 $5", substr($map["parcel_id"], 2, 5));
$map["parcel-1"] = preg_replace("~(.)(.)(.)~", "$1 $2 $3 $4 $5", substr($map["parcel_id"], 7, 3));
$seqnum = $sql->runSP($tokens[0], $tokens[1], "dbo.sp_get_pdf_data", [
$seqnum = $sql->runSP($tokens["bearer_token"], $tokens["connection_token"], "dbo.sp_get_pdf_data", [
"parcel_id" => $this->id,
"form_type" => "overval"
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ public function beginUpdateImport(string $operation = "") {
case "import":
$payload = $this->request->getCurrentRequest()->getContent();
$payload = json_decode(strip_tags($payload), TRUE);

if (empty($payload)) {
return new CacheableJsonResponse([
'status' => 'Require a payload.',
'response' => 'error'
], 400);
}

try {
$this->queuePayload("mnl_${operation}", $payload);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,20 @@ class MNLProcessImport extends QueueWorkerBase {
*
* @var array
*/
private $stats = [];
private $stats = [
"cache" => 0,
"pre-entities" => 0,
"post-entities" => 0,
"processed" => 0,
"updated" => 0,
"inserted" => 0,
"unchanged" => 0,
"baddata" => 0,
"duplicateSAM" => 0,
"duplicateNID" => 0,
"queue" => NULL,
"starttime" => NULL,
];

/**
* Property indicating if a purger invalidation queue exists
Expand Down Expand Up @@ -67,6 +80,8 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition

// If the queue is not empty, then prepare to process the queue
if ($this->queue->numberOfItems() > 0) {
$this->stats["queue"] = $this->queue->numberOfItems();
$this->stats["starttime"] = strtotime("now");

if ($this->settings->get("{$plugin_id}_import_status") == MnlUtilities::MNL_IMPORT_READY) {

Expand All @@ -86,20 +101,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
->condition("n.type", "neighborhood_lookup");
$query->addExpression("count(n.nid)", "count");
$result = $query->execute()->fetch();
$this->stats = [
"queue" => $this->queue->numberOfItems(),
"cache" => 0,
"pre-entities" => $result ? $result->count : 0,
"post-entities" => 0,
"processed" => 0,
"updated" => 0,
"inserted" => 0,
"unchanged" => 0,
"baddata" => 0,
"duplicateSAM" => 0,
"duplicateNID" => 0,
"starttime" => strtotime("now"),
];
$this->stats["pre-entities"] = $result ? $result->count : 0;
$this->settings->set('tmp_import', json_encode($this->stats));
$this->settings->save();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,20 @@ class MNLProcessUpdate extends QueueWorkerBase {
*
* @var array
*/
private $stats = [];
private $stats = [
"cache" => 0,
"pre-entities" => 0,
"post-entities" => 0,
"processed" => 0,
"updated" => 0,
"inserted" => 0,
"unchanged" => 0,
"baddata" => 0,
"duplicateSAM" => 0,
"duplicateNID" => 0,
"queue" => NULL,
"starttime" => NULL,
];

/**
* Property indicating if a purger invalidation queue exists
Expand Down Expand Up @@ -68,6 +81,9 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
// If the queue is not empty, then prepare to process the queue
if ($this->queue->numberOfItems() > 0) {

$this->stats["queue"] = $this->queue->numberOfItems();
$this->stats["starttime"] = strtotime("now");

if ($this->settings->get("{$plugin_id}_import_status") == MnlUtilities::MNL_IMPORT_READY) {

if ($this->settings->get("mnl_import_import_status") == MnlUtilities::MNL_IMPORT_PROCESSING) {
Expand All @@ -86,20 +102,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition
->condition("n.type", "neighborhood_lookup");
$query->addExpression("count(n.nid)", "count");
$result = $query->execute()->fetch();
$this->stats = [
"queue" => $this->queue->numberOfItems(),
"cache" => 0,
"pre-entities" => $result ? $result->count : 0,
"post-entities" => 0,
"processed" => 0,
"updated" => 0,
"inserted" => 0,
"unchanged" => 0,
"baddata" => 0,
"duplicateSAM" => 0,
"duplicateNID" => 0,
"starttime" => strtotime("now"),
];
$this->stats["pre-entities"] = $result ? $result->count : 0;
$this->settings->set('tmp_update', json_encode($this->stats));
$this->settings->save();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,11 @@ public function generate_fillable() {
return FALSE;
}

/**
* Returns the template file location, creates folder if it does not exist.
*
* @return string
*/
/**
* Returns the template file location, creates folder if it does not exist.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,25 @@ public function runSP($bearer_token, $connection_token, string $sp_name, array $
return $data;
}

public function runSelect($bearer_token,$connection_token,$table,$filter,$sort,$limit,$page,$fields) {
public function runSelect($bearer_token, $connection_token, $table, $fields, $filter = NULL, $sort = NULL, $limit = NULL, $page = NULL) {

$post_fields = [
"token" => $connection_token,
"table" => $table,
];
if($filter){
if ($filter !== NULL){
$post_fields["filter"] = $filter;
}
if($sort !== null){
if ($sort !== NULL){
$post_fields["sort"] = $sort;
}
if($limit !== null){
if ($limit !== NULL){
$post_fields["limit"] = $limit;
}
if($page !== null){
if ($page !== NULL){
$post_fields["page"] = $page;
}
if($fields !== null){
if ($fields !== NULL){
$post_fields["fields"] = $fields;
}

Expand Down Expand Up @@ -198,8 +198,12 @@ public function getToken($app_name) {

if (isset($info)) {
$data = json_decode($info,true);
$data = [$data["authToken"],$dbconnector_env["conntoken_" . $app_name],];
} else {
$data = [
"bearer_token" => $data["authToken"],
"connection_token" => $dbconnector_env["conntoken_" . $app_name]
];
}
else {
$data = null;
}

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const configProps = {
"cards": {
"polling_information": {
"display": true,
// DU DIG-2904 & DIG-3820
"redistricting": false,
},
"mayor": {
"display": true,
Expand All @@ -20,7 +22,7 @@ const configProps = {
"url": "/departments/mayors-office",
},
"city_councilor": {
"display": false, // DU DIG-2904 09/2023
"display": true, // DU DIG-2904 & DIG-3820
},
"neighborhood_contact": {
"display": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class Representation extends React.Component {
];
}
let contentPollingArray;
let contentPolingArrayRedistrict;
if (this.props.ward == null || this.props.precinct == null) {
contentPollingArray = [
{
Expand All @@ -70,27 +71,28 @@ class Representation extends React.Component {
heading: this.props.voting_location,
content: this.props.voting_address
},*/
// DU DIG-2904 09/2023
// temp remove Polling information adn replace with a message.
// {
// heading: "Ward",
// content: this.props.ward
// },
// {
// heading: "Precinct",
// content: this.props.precinct
// },
// {
// content: <div><a href={"https://www.sec.state.ma.us/VoterRegistrationSearch/MyVoterRegStatus.aspx"} target="_blank" rel="noreferrer" className="mnl-link">Check the state's website</a> to find out if you are registered to vote, and where your polling location is.</div>
// },
//
// {
// content: <ul class="ul"><li><a href={"https://boston.maps.arcgis.com/apps/webappviewer/index.html?id=72a95777f7e842eaae3671c0d67acce0&find=" + this.props.sam_id} target="_blank" rel="noreferrer" className="mnl-link">Explore the City's wards and precincts</a></li></ul>
// }
{
content: <div>Due to redistricting, your District City Councilor may change as of January 1, 2024. To find out which race you are voting for in the 2023 Municipal Election, <a href={"/departments/elections/find-out-who-you-are-voting-2023-district-city-council-race"}>please refer to our informational website.</a></div>
heading: "Ward",
content: this.props.ward
},
{
heading: "Precinct",
content: this.props.precinct
},
{
content: <div><a href={"https://www.sec.state.ma.us/VoterRegistrationSearch/MyVoterRegStatus.aspx"} target="_blank" rel="noreferrer" className="mnl-link">Check the state's website</a> to find out if you are registered to vote, and where your polling location is.</div>
},

{
content: <ul class="ul"><li><a href={"https://boston.maps.arcgis.com/apps/webappviewer/index.html?id=72a95777f7e842eaae3671c0d67acce0&find=" + this.props.sam_id} target="_blank" rel="noreferrer" className="mnl-link">Explore the City's wards and precincts</a></li></ul>
}
];
// DU DIG-2904 & DIG-3820
contentPolingArrayRedistrict = [
{
content: <div>Due to redistricting, your District City Councilor may change as of January 1, 2024. To find out which race you are voting for in the 2023 Municipal Election, <a href={"/departments/elections/find-out-who-you-are-voting-2023-district-city-council-race"}>please refer to our informational website.</a></div>
}
]

}
let contentEarlyVotingArray;
Expand Down Expand Up @@ -146,14 +148,19 @@ class Representation extends React.Component {
// Content for Councilors at Large
const contentCouncilorsatLargeReps = [
{
// DU DIG-2904 & DIG-3820
content: (
<div class="councilor-at-large">
<div class="intro">The four at-large councilors that represent the entire city:</div>
<div>
<a href={"/departments/city-council/michael-flaherty"} className={"mnl-link link_underline"}>Michael Flaherty</a>
<a href={"/departments/city-council/ruthzee-louijeune"} className={"mnl-link link_underline"}>Ruthzee Louijeune</a>
<a href={"/departments/city-council/julia-mejia"} className={"mnl-link link_underline"}>Julia Mejia</a>
<a href={"/departments/city-council/erin-murphy"} className={"mnl-link link_underline"}>Erin Murphy</a>
<a href={'/departments/city-council/ruthzee-louijeune'}
className={'mnl-link link_underline'}>Ruthzee Louijeune</a>
<a href={'/departments/city-council/julia-mejia'}
className={'mnl-link link_underline'}>Julia Mejia</a>
<a href={'/departments/city-council/erin-murphy'}
className={'mnl-link link_underline'}>Erin Murphy</a>
<a href={'/departments/city-council/henry-santana'}
className={'mnl-link link_underline'}>Henry Santana</a>
</div>
</div>
)
Expand All @@ -174,12 +181,12 @@ class Representation extends React.Component {
{/* Polling Info */}
{(configCards.polling_information.display) ? (
<MnlCard
// DU DIG-2904 title={"Your Polling Information"}
title={"City Council and Voting Information"}
// DU DIG-2904 & DIG-3820
title={configCards.polling_information.redistricting ? "City Council and Voting Information": "Your Polling Information"}
image_header={
configProps.globals.pathImage+"voting_ballot.svg"
}
content_array={contentPollingArray}
content_array={configCards.polling_information.redistricting ? contentPolingArrayRedistrict :contentPollingArray}
/>
) : null}

Expand Down

This file was deleted.

Loading

0 comments on commit df4ba62

Please sign in to comment.