<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pamela Torres-Rocca</title>
    <description>The latest articles on DEV Community by Pamela Torres-Rocca (@pamela454).</description>
    <link>https://dev.to/pamela454</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F633608%2F2aeae16c-483c-4ffe-b283-be0ff1d509cb.png</url>
      <title>DEV Community: Pamela Torres-Rocca</title>
      <link>https://dev.to/pamela454</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pamela454"/>
    <language>en</language>
    <item>
      <title>#Increasing the Loading Speed of a CLI Web Scraper to Improve the User Experience...</title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Thu, 21 Oct 2021 19:27:35 +0000</pubDate>
      <link>https://dev.to/pamela454/measuring-and-reducing-the-load-time-of-a-cli-web-scraper-1e78</link>
      <guid>https://dev.to/pamela454/measuring-and-reducing-the-load-time-of-a-cli-web-scraper-1e78</guid>
      <description>&lt;p&gt;Slow application load times can cause frustration on behalf of the user. This can lead to users abandoning the use of the application. &lt;/p&gt;

&lt;p&gt;In the terminal, you can use the Linux time command to retrieve the time it takes to run a command. The command I used was time  ./bin/Urgentcare. This command starts the application and loads a menu for the user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;real    0m12.122s
user    0m4.472s
sys 0m2.130s

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The real time listed is the total start to end time of the call. The above time is the time for the scraper application to load the initial menu after the command "time  ./bin/Urgentcare". The menu is displayed to the user after the application is started. This requires that the website is scraped and office objects are created with the data. &lt;/p&gt;

&lt;p&gt;According to google think, the user bounce rate greatly increases once the load time goes from 1 to 3 seconds. The initial 12 second load time for the menu far exceeds that expectation. This could be due to the website itself taking a long time to load and/or the code is taking a long time to run.&lt;/p&gt;

&lt;p&gt;To help resolve this issue you can provide feedback to the user to let them know that the application is successfully running that the data they are looking for is loading. I added a simple method in the CLI component called loading_message that prints a message to the screen that the data is loading. This way the user knows that the application is working and that their input was valid.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Welcome to the Urgent Care CLI




Retrieving data....
Loading......
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In order to reduce how long it took the main menu to load, I changed one of the iterators from .each_with_index to .each. The office_url method that used it did not really require the addition of an index as a different method call was already adding it. This helped to reduce the load time. &lt;/p&gt;

&lt;p&gt;However, the biggest factor in increasing the speed of the application was refactoring the code so that I was not waiting for a call to each individual office page to retrieve the current appointment times before loading the initial user menu. Instead, I now only call the office page for the appointment time upon user request from the initial menu. This produced a new time of&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;real    0m4.145s
user    0m1.451s
sys 0m0.861s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to run the time  ./bin/Urgentcare command. This is now one third the time it took to load the menu prior to the refactor. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>ruby</category>
      <category>webdev</category>
      <category>performance</category>
    </item>
    <item>
      <title>#Writing Tests for a Ruby Application</title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Tue, 28 Sep 2021 19:31:02 +0000</pubDate>
      <link>https://dev.to/pamela454/rspec-to-test-code-in-cli-application-39on</link>
      <guid>https://dev.to/pamela454/rspec-to-test-code-in-cli-application-39on</guid>
      <description>&lt;p&gt;Recently, I went back to the first CLI application that I had written in order to test the behavior of the application. I had recently created a new version of this application to support html changes to the website that it scrapes. The changes to the site were preventing the application from scraping the desired appointment time and location from the site. After the update to the application, I wanted to make sure that the behavior was still what I needed it to do. &lt;br&gt;
To test behavior I used a gem called rspec that tests code in Ruby. The version is 3.10.0 and I used the documentation at &lt;a href="https://relishapp.com/rspec/rspec-mocks/v/3-10/docs/basics"&gt;https://relishapp.com/rspec/rspec-mocks/v/3-10/docs/basics&lt;/a&gt; as well as Stack Overflow for some examples of mocks and stubs. To get a good overview of testing using rspec I completed sections of the LinkedIn elearning course Ruby: Testing with RSpec to learn basic syntax. &lt;/p&gt;

&lt;p&gt;I wrote a separate test file for each class of the component. Since I wanted to test the behavior of individual methods within the class, I needed to isolate each method and which was challenging as each method typically called an additional method within itself. In order to prevent the program from continuing to run while testing an individual method, I used test doubles which are objects that stand in for other objects. Each class was dependent on other classes, so I needed to write doubles for the other dependent classes in each test file to ensure that I was only testing the behavior of the current class. &lt;/p&gt;

&lt;p&gt;Test Doubles for Classes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
RSpec.describe Urgentcare::CLI do 

    let!(:cliInstance) {Urgentcare::CLI.new}
    let!(:office) {Urgentcare::Office}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The specific kinds of test doubles that I used were mocks which replicate the method that it is standing in for. You need to explicitly spell out the behavior that you need the mock to have. I also used stubs which gave an object behavior. For example I created an Office double and gave it data to return when this instance is called. &lt;/p&gt;

&lt;p&gt;Office Class Double with Test Data&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let!(:office) {Urgentcare::Office}

    before(:each) do
      @index = 0
      @new_array = []                
      @offices = @new_array &amp;lt;&amp;lt; office.new("Worcester Greenwood St", "https://www.carewellurgentcare.com/urgent-care-appointment-form-worcester-greenwood/", "2:00 PM Friday, September 17 (EDT)  ", "(617) 804-6293 ")
    end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This Office double was used to test the output displayed to the user in the following spec:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;it "displays office details when valid office selected" do
      allow(cliInstance).to receive(:list).and_return("List")
      cliInstance.instance_variable_set(:@index, 0)
      expect { cliInstance.office_details }.to output(a_string_starting_with(" \n---\nOffice Name: Worcester Greenwood St\nOffice Number: (617) 804-6293 \nOffice URL: https://www.carewellurgentcare.com/urgent-care-appointment-form-worcester-greenwood/\nOffice Next Available Appointment: 2:00 PM Friday, September 17 (EDT)")).to_stdout
    end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Strategic use of object doubles in testing isolates the specific class and method behavior that you want to test. In the example of the scraper it also allows for testing without requiring the use of the internet.  &lt;/p&gt;

</description>
      <category>testing</category>
      <category>ruby</category>
      <category>beginners</category>
      <category>testdev</category>
    </item>
    <item>
      <title>#State Management in a React Application using Redux for Beginners </title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Wed, 04 Aug 2021 19:52:39 +0000</pubDate>
      <link>https://dev.to/pamela454/state-management-in-a-react-application-using-redux-b5k</link>
      <guid>https://dev.to/pamela454/state-management-in-a-react-application-using-redux-b5k</guid>
      <description>&lt;p&gt;State vs props in react can be a difficult concept for beginners to wrap their heads around. State is private in the component while props can be viewed by the user and not changed. Frameworks such as React and state management tools such as Redux keep an updated copy of the state in one location. State management becomes a more complex issue the larger the application becomes due to increased dependency between the components. &lt;/p&gt;

&lt;p&gt;Redux can be used with multiple frameworks and I used it in my project with React. In my application the "state" told the application who the user was, a history of charges and/or payments made to their account, as well as which departments were associated with the payments and charges. A global management tool reduces the amount of prop passing that you need to do between components. Data will flow down from this updated store to any components that need it. Because all of the components that I built with the exception of my forms were dependent on each other for data, I used a state management tool.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class AccountContainer extends Component {
    componentDidMount() {
        this.props.getAllAccounts();
    }

    //can call lifecycle hooks
    //render stated component
    //return react element from render function

    render() {
        console.log(this.props.accounts);

        return (
            &amp;lt;div&amp;gt;
                &amp;lt;Switch&amp;gt;
                    &amp;lt;Route exact path="/accounts/new" component={AccountNew} /&amp;gt;
                    &amp;lt;Route
                        exact
                        path="/accounts/:id"
                        render={(props) =&amp;gt; {
                            console.log(this.props.accounts);
                            console.log(this.props.account);
                            return (
                                &amp;lt;Account
                                    {...props}
                                    account={this.props.account}
                                /&amp;gt;
                            );
                        }}
                    /&amp;gt;
                    &amp;lt;Route
                        exact
                        path="/accounts"
                        render={(props) =&amp;gt; {
                            return (
                                &amp;lt;Accounts
                                    {...props}
                                    accounts={this.props.accounts}
                                /&amp;gt;
                            );
                        }}
                    /&amp;gt;
                &amp;lt;/Switch&amp;gt;
            &amp;lt;/div&amp;gt;
        );
    }
}
//selects part of data from the store that the component needs. receives entire store, returns object
//is this needed if not displaying list of accounts?
const mapStateToProps = (state) =&amp;gt; {
    //subscribe to redux updates
    //this is the state from redux
    return {
        account: state.loginFormReducer, //accounts located inside the state
        accounts: state.accounts,
    };
};
//dispatch happens automatically with connect
export default connect(mapStateToProps, { getAllAccounts })(AccountContainer);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I used local state for my forms because I only needed to display what the user was entering into the form back to the user on the page. This state data was then passed to an action, followed by a reducer which then updates the global state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class AccountNew extends React.Component {
  state = { name: "", balance: "" };

  onChange = (event) =&amp;gt; {
    this.setState({
      //do not directly set state, can accept a function to display most up to date value
      [event.target.name]: event.target.value,
    });
  };

  handleSubmit = (event) =&amp;gt; {
    event.preventDefault();
    this.props.newAccount(this.state);
    this.setState({
      name: "",
      balance: "",
    });
  };

  render() {
    return (
      &amp;lt;div&amp;gt;
        &amp;lt;form onSubmit={this.handleSubmit}&amp;gt;
          &amp;lt;label&amp;gt;Account Name: &amp;lt;/label&amp;gt;
          &amp;lt;input
            type="text"
            placeholder="Name"
            value={this.state.name}
            name="name"
            onChange={this.onChange}
          /&amp;gt;
          &amp;lt;br /&amp;gt;
          &amp;lt;label&amp;gt;Account Balance: &amp;lt;/label&amp;gt;
          &amp;lt;input
            type="text"
            placeholder="Balance"
            value={this.state.balance}
            name="balance"
            onChange={this.onChange}
          /&amp;gt;
          &amp;lt;br /&amp;gt;
          &amp;lt;input type="submit" /&amp;gt;
        &amp;lt;/form&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Aside from these examples of global and local state, I persisted some data in localStorage which is an object that stores a string with no expiration time. This data stated that the user was logged in and was used by logic throughout different components to display different messages to the user based on login status. &lt;/p&gt;

&lt;p&gt;In App Component - Creating a const with the value from localStorage&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import { Switch, Route, Redirect, withRouter } from "react-router-dom";
import { connect } from "react-redux";
import AccountContainer from "./containers/AccountContainer";
import NavBar from "./components/NavBar.js";
import DepartmentsContainer from "./containers/DepartmentsContainer";
import PaymentsContainer from "./containers/PaymentsContainer";
import Login from "./components/registrations/Login";
import Signup from "./components/registrations/Signup";
import "./App.scss";

function App(props) {
  const currentAccount = localStorage.getItem("loggedIn");
  return (
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Storing LoggedIn value in Account Action when User logs in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export const getAccount = (data, history) =&amp;gt; {
  //a thunk
  return (dispatch) =&amp;gt; {
    console.log(data.relationships.account.data.id);
    return fetch(
      `http://localhost:3001/api/v1/accounts/${data.relationships.account.data.id}`,
      {
        method: "GET",
        credentials: "same-origin",
        headers: {
          "Content-Type": "application/json",
        },
        body: JSON.stringify(),
      }
    )
      .then((res) =&amp;gt; res.json())
      .then((account) =&amp;gt; {
        if (account.error) {
          console.log(account);
          alert("error");
        } else {
          console.log(account.data.id);
          localStorage.setItem("loggedIn", true); //can only set string, JSON.stringify to convert
          dispatch(setCurrentAccount(account.data));
          history.push(`/accounts/${account.data.id}`);
        }
      })
      .catch(console.log);
  };
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>beginners</category>
      <category>react</category>
      <category>redux</category>
    </item>
    <item>
      <title># Making Your Website More Accessible. What does it mean? </title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Wed, 14 Jul 2021 20:23:36 +0000</pubDate>
      <link>https://dev.to/pamela454/making-your-website-more-accessible-what-does-it-mean-1hjk</link>
      <guid>https://dev.to/pamela454/making-your-website-more-accessible-what-does-it-mean-1hjk</guid>
      <description>&lt;p&gt;There are modifications that you can make to your website that makes it easier for users with a handicap to access. This is called accessibility. Some of these modifications include using appropriate HTML elements such as Title and Header. These changes often align with better Search Engine Optimization results which enables your page to be found in searches and helps to drive more traffic to the page. &lt;br&gt;
   You can test how accessible your website is in order to make the changes that will have the greatest impact on accessibility. One way to do this is using the WebDeveloper extension tool for Chrome, can be downloaded at &lt;a href="https://chrome.google.com/webstore/detail/web-developer/bfbameneiokkgbdmiekhjnmfkcnldhhm?hl=en-US"&gt;https://chrome.google.com/webstore/detail/web-developer/bfbameneiokkgbdmiekhjnmfkcnldhhm?hl=en-US&lt;/a&gt;. Another way to do this specifically for visually impaired users is try out your application using a screen reader. Screen readers read the web content to the user. On a Mac computer this is done using VoiceOver &lt;a href="https://support.apple.com/guide/voiceover/browse-webpages-vo27974/10/mac/11.0"&gt;https://support.apple.com/guide/voiceover/browse-webpages-vo27974/10/mac/11.0&lt;/a&gt;. On a Windows computer this is done using Narrator &lt;a href="https://www.pcmag.com/how-to/how-to-use-windows-10s-narrator-to-read-your-screen-aloud"&gt;https://www.pcmag.com/how-to/how-to-use-windows-10s-narrator-to-read-your-screen-aloud&lt;/a&gt;. &lt;br&gt;
    Accessibility is particularly important for applications in the healthcare space as everyone needs to access healthcare services. Such an essential service must allow users to locate healthcare services in order to receive the care that they need. One application that I wrote allowed patients to ask a question regarding their healthcare and receive a specialty specific response. I made a few changes to the landing page to make it easier for a screen reader to read the content. The following is what the landing page initially looked like: &lt;/p&gt;

&lt;p&gt;Welcome Page Prior to Accessibility Changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;style&amp;gt;
      body {
      background-image: url('&amp;lt;%= asset_path 'camilo-jimenez-vGu08RYjO-s-unsplash.jpg' %&amp;gt;');
      background-size: cover;
      }
      .center {
        justify-content: center;
      }
      .navbar-custom {
        background-color: #D8DEEE;
      }
      .sign-in {
        border: 0;
        border-radius: 1rem;
        box-shadow: 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.1);
        background-color: #D8DEEE;
      }
      .card-signin .card-title {
        margin-bottom: 2rem;
        font-weight: 300;
        font-size: 1.5rem;
      }
      .card-signin .card-body {
        padding: 2rem;
      }

&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;div class="text-center center font-weight-bold"&amp;gt;
  &amp;lt;nav class="navbar navbar-custom sticky-top center"&amp;gt;&amp;lt;h1&amp;gt;Welcome to Ask Your Health Question&amp;lt;/h1&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;% if flash[:notice] %&amp;gt;
&amp;lt;div class="notice"&amp;gt;&amp;lt;h2&amp;gt;&amp;lt;%= flash[:notice] %&amp;gt;&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;% end %&amp;gt;
 &amp;lt;/div&amp;gt;
&amp;lt;/nav&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div class="container-fluid mx-auto text-nowrap text-dark" style="width: 500px;"&amp;gt;
  &amp;lt;table class="table table-striped"&amp;gt;
    &amp;lt;thead&amp;gt;
      &amp;lt;tr&amp;gt;

&amp;lt;%= form_for(:session, url: "sessions/create", html: { autocomplete: "new-password" })   do |f| %&amp;gt;
&amp;lt;br&amp;gt;
&amp;lt;div class="col sign-in card-title card-body"&amp;gt;
&amp;lt;h3&amp;gt;Sign in if you are a Member&amp;lt;/h3&amp;gt;
&amp;lt;div class="field"&amp;gt;&amp;lt;%= label :name, "Enter your email"%&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
  &amp;lt;%= f.text_field :email, :class =&amp;gt; "span5"  %&amp;gt;
&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;

&amp;lt;div class="field"&amp;gt;&amp;lt;%= label :password, "Enter your password" %&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
  &amp;lt;%= f.password_field :password, :class =&amp;gt; "span5"  %&amp;gt;
&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;

&amp;lt;div class="actions"&amp;gt;
  &amp;lt;%= f.submit "Sign In"  %&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;% end %&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;

&amp;lt;h3&amp;gt;Create a New Account&amp;lt;/h3&amp;gt;

&amp;lt;%= link_to('Login with Facebook!', '/auth/facebook') %&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
&amp;lt;%= link_to('Create a New Account as a Patient', 'users/new_patient') %&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
&amp;lt;%= link_to('Create a New Account as a Physician', 'users/new_physician') %&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;

  &amp;lt;/table&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With a quick change to include a descriptive title element without an additional header .&lt;/p&gt;

&lt;p&gt;Welcome Page After Accessibility Changes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;style&amp;gt;
      body {                     
      background-image: url('&amp;lt;%= asset_path 'camilo-jimenez-vGu08RYjO-s-unsplash.jpg' %&amp;gt;');
      background-size: cover;
      }
      .center {
        justify-content: center;
      }
      .navbar-custom {
        background-color: #D8DEEE;
      }
      .sign-in {
        border: 0;
        border-radius: 1rem;
        box-shadow: 0 0.5rem 1rem 0 rgba(0, 0, 0, 0.1);
        background-color: #D8DEEE;
      }
      .card-signin .card-title {
        margin-bottom: 2rem;
        font-weight: 300;
        font-size: 1.5rem;
      }
      .card-signin .card-body {
        padding: 2rem;
      }

&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;div class="text-center center font-weight-bold"&amp;gt;
    &amp;lt;nav class="navbar navbar-custom sticky-top center"&amp;gt;&amp;lt;/nav&amp;gt;
    &amp;lt;title&amp;gt;Company Name: Welcome to Ask Your Health Question &amp;lt;%= content_for(:title) %&amp;gt;&amp;lt;/title&amp;gt; &amp;lt;%#changed to a title tag%&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;% if flash[:notice] %&amp;gt;
&amp;lt;div class="notice"&amp;gt;&amp;lt;h2&amp;gt;&amp;lt;%= flash[:notice] %&amp;gt;&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;% end %&amp;gt;
 &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div class="container-fluid mx-auto text-nowrap text-dark" style="width: 500px;"&amp;gt;
  &amp;lt;table class="table table-striped"&amp;gt;
    &amp;lt;thead&amp;gt;
      &amp;lt;tr&amp;gt;

&amp;lt;%= form_for(:session, url: "sessions/create", html: { autocomplete: "new-password" })   do |f| %&amp;gt;
&amp;lt;div class="col sign-in card-title card-body"&amp;gt;
&amp;lt;h3&amp;gt;Sign in if you are a Member&amp;lt;/h3&amp;gt;
&amp;lt;br&amp;gt;
&amp;lt;div class="field"&amp;gt;&amp;lt;%= label :name, "Enter your email"%&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
  &amp;lt;%= f.text_field :email, :class =&amp;gt; "span5"  %&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div class="field"&amp;gt;&amp;lt;%= label :password, "Enter your password" %&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
  &amp;lt;%= f.password_field :password, :class =&amp;gt; "span5"  %&amp;gt;
&amp;lt;/div&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;

&amp;lt;div class="actions"&amp;gt;
  &amp;lt;%= f.submit "Sign In"  %&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;% end %&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;

&amp;lt;h3&amp;gt;Create a New Account&amp;lt;/h3&amp;gt;

&amp;lt;%= link_to('Login with Facebook!', '/auth/facebook') %&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
&amp;lt;%= link_to('Create a New Account as a Patient', 'users/new_patient') %&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
&amp;lt;%= link_to('Create a New Account as a Physician', 'users/new_physician') %&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;

  &amp;lt;/table&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title># Controlled Components in React Payment Application</title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Fri, 02 Jul 2021 14:27:08 +0000</pubDate>
      <link>https://dev.to/pamela454/controlled-components-in-react-payment-application-1jgb</link>
      <guid>https://dev.to/pamela454/controlled-components-in-react-payment-application-1jgb</guid>
      <description>&lt;p&gt;In my final react project which adds charges and processes payments, I had several forms that the user could interact with in order to login, logout, and submit a payment in the application. &lt;br&gt;
   The default HTML form behavior is to browse to a new page once the form is submitted. Unless a controlled form is used in react, the data is handled by the DOM and not the virtual DOM. However, in the controlled components that I wrote to handle login, logout, and payment submission behavior, the data added by the user is used in a callback function. The user will input the information and the component will update the state through the javascript functions that handle form change and submission. Each state attribute is also accepted by the component as a prop. When the user types their input, the component state changes and the user is able to see their changes displayed as props in the react component. Currently the only validations occur when the form is submitted on the backend. However, validations could be added in this component to give the user feedback prior to form submission. &lt;br&gt;
The name and password attributes in the state are used to conditionally render different parts of components and display any associated data such as payments and charges.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Login = ({ login, name, password, setCurrentAccount, history }) =&amp;gt; {
  const [form, setForm] = useState({
    //array destructuring
    account: {
      name: "",
      password: "",
    },
  });

  const handleLoginFormChange = (event, target) =&amp;gt; {
    setForm({
      ...form,
      [target]: event.target.value,
    });
  };

  const handleLoginFormSubmit = (event) =&amp;gt; {
    //does this need to be bound?
    event.preventDefault(); //state contains most up to date form data. prevent page refresh
    login(form, history);
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Javascript function that takes in the form data then calls the login action and updates the state. &lt;br&gt;
We have an initial state of form and we can update it with the setForm function. This is defined in the useState hook. &lt;/p&gt;

</description>
      <category>rails</category>
      <category>react</category>
    </item>
    <item>
      <title># Hoisting and Scope for Beginners </title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Thu, 17 Jun 2021 18:18:00 +0000</pubDate>
      <link>https://dev.to/pamela454/hoisting-and-scope-for-beginners-1308</link>
      <guid>https://dev.to/pamela454/hoisting-and-scope-for-beginners-1308</guid>
      <description>&lt;p&gt;There are two concepts that are important to be familiar with when first learning to code in Javascript. Misinterpreting them can cause you some frustration when searching for errors in your code. &lt;/p&gt;

&lt;p&gt;Scope are the variables and functions available for use within the current execution context. The execution context is the environment in which the code is being run.  In Javascript the scope could be the global scope, the function scope, or the block scope.  Variables declared in the global scope are accessible anywhere throughout the code. Within an execution context, when a variable is referenced, that context can look further up the scope chain to find the declaration of the variable. So a function within a function can search both the outer function and the global scope. Keep this in mind when trying to access values stored in variables. A reference error may indicate that the variable was declared and assigned, just not accessible within your current scope.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        //Global variable accessed from within a function

        let userId = function retrieveuserId(){

              return $('h2#userid').data('user-id')

            }  

 function listenForClick() {

         console.log('setting up click handler');

    $("button#messages-data").on('click', event =&amp;gt; {

        console.log('button clicked');

          event.preventDefault()  


        var url = `${userId()}/messages.json`

        fetch(url,   {

            })

            .then(res =&amp;gt; res.json()) 

            .then(allMessages =&amp;gt; {

                $('.square').html('')

                console.log(allMessages)



                allMessages.forEach(message =&amp;gt; {

                    let newMessage = new Message(message)

                    let messageHtml = newMessage.postHTML()

                    $('.square').append(messageHtml)

                })

            })

            .catch(error =&amp;gt; console.error('Error:', error));



    })

}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hoisting is when a variable or function declaration is available at the top of it's scope even though the declaration is below the call to the function or variable. When a function is invoked prior to its assignment, the function is still executed due to hoisting. Function declarations are hoisted before variables are. Using var to declare  a variable after the variable is invoked, will return "undefined". Using let and const and then referencing them before they have been declared will return a reference error instead of undefined.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     //returns the desired text 'Patient Message' due to hoisting 

       messageRetriever();

               function messsageRetriever() {
                      return ’Patient Message’;
                  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The addition of let and const in ES6 can cause some confusion around the concepts of scope and hoisting.  Prior to ES6, most variables were declared with var. With var you can declare a variable twice in the code without receiving an error message. Const and let will not allow you to declare a variable (give it a name) a second time. Const also cannot be reassigned (set to a value). When a variable is declared without a keyword (such as var, let or const), it is automatically considered a global variable and is accessible within the global scope no matter where it was declared in the code.  When var is declared in a block, it can still be accessed outside of that block scope. Const and let are block scoped and when declared in a block, will not allow the values to be accessed outside of the block and will return an error. &lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title># Javascript Project</title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Thu, 17 Jun 2021 18:11:23 +0000</pubDate>
      <link>https://dev.to/pamela454/javascript-project-204a</link>
      <guid>https://dev.to/pamela454/javascript-project-204a</guid>
      <description>&lt;p&gt;For my Rails project, I created an application that would allow users who registered as patients to ask medical questions to physicians. Users who register as physicians can answer these questions. &lt;/p&gt;

&lt;p&gt;For my Javascript Project, I used this language to add the ability for my patient users to see an index of all of the questions that they have asked as well as a show page which displays all of the details of that question as well as all of the responses that this question has received. This allows the user to quickly find information that is relevant to them and quickly flip back and forth between questions as they do not have to leave their own personal user show page. &lt;/p&gt;

&lt;p&gt;The user can also ask a new question in order to receive help from the online physicians. To do this, they are directed to a new question form which when submitted displays all of the information submitted as a new question. This confirms to the user that their question was submitted and lets them review all of the information that they physician will see again without leaving the page. These features enhance the user experience by displaying results more quickly and reducing the number of clicks that the user has to perform. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>ruby</category>
      <category>rails</category>
    </item>
    <item>
      <title># Single Table Inheritance vs. Polymorphic Association</title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Thu, 17 Jun 2021 18:07:40 +0000</pubDate>
      <link>https://dev.to/pamela454/single-table-inheritance-vs-polymorphic-association-25p</link>
      <guid>https://dev.to/pamela454/single-table-inheritance-vs-polymorphic-association-25p</guid>
      <description>&lt;p&gt;For my Ruby on Rails project, I needed to choose a setup so that two different users could access the application. I chose a single table inheritance because my two users shared most of the same data. The table would also be small and not accessed by other tables. Searching becomes more time consuming when the table is large and has many nil values. &lt;/p&gt;

&lt;p&gt;One user acts as a patient and is able to send messages to physician users. Their profile is simple and consists of a name, email address and password. The other user is a physician and has the same data as a patient as well as an NPI number that is unique to each physician as well as their specialty.  &lt;/p&gt;

&lt;p&gt;The application allows patients to submit medical questions for physicians to answer. The single table inheritance design setup allows for all users to inherit from the user class reducing and streamlining the code. &lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>design</category>
    </item>
    <item>
      <title># Sinatra Project - Electronic Medical Record</title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Thu, 17 Jun 2021 18:05:44 +0000</pubDate>
      <link>https://dev.to/pamela454/sinatra-project-electronic-medical-record-27gl</link>
      <guid>https://dev.to/pamela454/sinatra-project-electronic-medical-record-27gl</guid>
      <description>&lt;p&gt;For my Sinatra project, I developed an application that would function as an electronic medical record.  Medical records provide clear, easy access to patient data. This allows clinicians to have up to date access in order to make clinical decisions. &lt;/p&gt;

&lt;p&gt;This application allows patients to log in to view their medical history and active medical problems that their physician is working on. Physicians are able to add patients,  and edit their medical history and problems. &lt;/p&gt;

&lt;p&gt;Validating the data entered into the database and ensuring that only physicians have editing access were big challenges for this project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  validates :username, :presence =&amp;gt; true, :uniqueness =&amp;gt; true
  validates :npi, :presence =&amp;gt; true, :uniqueness =&amp;gt; true, length: { minimum: 10 }
  validates :password, :presence =&amp;gt; true, length: { minimum: 5 }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code was entered into the physician model. This way every new physician entry must have a unique username, password, and an NPI number. The NPI number is a unique number that physicians are assigned for their work. &lt;/p&gt;

&lt;p&gt;I included a helper method that will tell whether a user is currently logged in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helpers do
        def logged_in?
            session[:id] != nil
        end
end

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method checks whether it a user is logged in for pages only to be viewed by users. Pages to allow editing and creating patients are only accessible due to code that checks is the current session id is equal to the physician id. This protects the integrity of the data and improves the user experience by only showing the user links and fields that are relevant to them. &lt;/p&gt;

</description>
      <category>sinatra</category>
      <category>ruby</category>
    </item>
    <item>
      <title>#Refactoring Command-Line Interface Project </title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Thu, 17 Jun 2021 17:18:08 +0000</pubDate>
      <link>https://dev.to/pamela454/updated-version-of-cli-gem-project-2ofo</link>
      <guid>https://dev.to/pamela454/updated-version-of-cli-gem-project-2ofo</guid>
      <description>&lt;p&gt;Recently I needed to refactor an application that I had written for the first project in my coding bootcamp. This was a scraper that collected data from an urgent care website to give the user the first available appointment time at their desired location. &lt;br&gt;
    The CLI no longer scraped the appropriate data due to some changes to the site. To correct this, many of the changes only required modifications to the data returned to get it to display properly. The office phone number was displaying information in addition to the phone number that was not relevant. This just required adding on the gsub method to remove the data that I did not want to display.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;office.phone_number = office_details.css('a[href]').text.gsub("Get DirectionsBook Urgent Care AppointmentBook COVID-19 TestBook Telemed Appointment", " ")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What made scraping easier on the new site was that the urgent care center information was now displayed in one column instead of two. I no longer needed to create two arrays and zip them together which had been very time consuming. &lt;br&gt;
   The site is designed to list the current available appointment times on the same page that lists each individual urgent care center. The site currently lists the next available time as "Invalid client specified". Previously I had been scraping the information off a second url which now did not work. Now the desired information was actually contained on each sites individual page in a dropdown menu contained in a iframe.&lt;br&gt;
     To get this information I wrote code to scrape the url for each individual urgent care centers site off the main page and stored it in a variable called url. I then passed this variable into a new method called get_waittime. The scraper then does to this new url and uses the waitir gem to wait until the element that identifies the iframe is loaded on the site.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def get_waittime(url) 
    @@new_browser = @@browser
    @@town_page = @@new_browser.goto(url)
    js_doc = @@new_browser.div(id: 'left-area').iframe.wait_until(&amp;amp;:present?)
    @wait_time = js_doc.button(data_id: "timeSelector").text.gsub("\n", " ")
    Urgentcare::Office.all[0].next_available = @wait_time
  end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next available wait time is then stored in a variable which can be added to the office object and displayed to the user. &lt;/p&gt;

</description>
      <category>ruby</category>
    </item>
    <item>
      <title>#Creating an Application to Give Current Urgent Care Wait Times</title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Thu, 10 Jun 2021 19:18:38 +0000</pubDate>
      <link>https://dev.to/pamela454/cli-gem-project-urgent-care-web-scraper-225</link>
      <guid>https://dev.to/pamela454/cli-gem-project-urgent-care-web-scraper-225</guid>
      <description>&lt;p&gt;My first project in Ruby is a CLI application that scrapes the website of a company that provides urgent care. Urgent care is provided to patients that typically cannot wait until the next business day but are not experiencing an illness or injury that is life-threatening. Many urgent care centers are located throughout Massachusetts to treat patients and prevent long wait times in the Emergency Department. My application lists the next available appointment time at urgent care centers in Massachusetts based on location. This provides a quick and easy way to find care.&lt;/p&gt;

&lt;p&gt;The biggest challenge when coding this project was to find the best way to organize the Scraper class. This class scrapes the website for the desired data and stores it in a separate Office class. All of the relevant data that I wanted was located under the node of ('.et_pb_column_1_4'). However, the relevant data for each office was located in two different ('.et_pb_column_1_4'). This required separating each ('.et_pb_column_1_4') into two separate arrays and then zipping them together in order to form one office_details array where each element contains the relevant data for each office.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  def get_clinics;
         url_array = [];
         digits_array = [];
         get_page.css('.et_pb_column_1_4').each_with_index do |location, index|
 if index.odd?
    url_array.push(location)
 else
    digits_array.push(location)
 end;
                         url_array;
                        digits_array;
         end
digits_array[0..16].zip(url_array[0..16]).each_with_index do |office_details, index|
        end
 end 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After getting past this barrier, scraping from each element of the office_details array was simpler. The next challenge was discovering that the Next Available Appointment Time data that I wanted on the second page was contained within an iframe. This required scraping the link for the individual office page, then the iframe link, and then the appointment time data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;doc_d = Nokogiri::HTML(open("https://www.carewellurgentcare.com#{office.url}"));
doc_i = doc_d.css('.locat').attr('src').text;
doc_n = Nokogiri::HTML(open(doc_i.to_s));
    office.next_available = doc_n.css('.panel-heading').text.strip.gsub("\r\n", ' ').split(',')[0]; 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While challenging, these obstacles taught me the importance of proper planning in order to return exactly the data that you are looking for.&lt;/p&gt;

</description>
      <category>refactorit</category>
      <category>ruby</category>
      <category>rails</category>
    </item>
    <item>
      <title># Final Portfolio Project</title>
      <dc:creator>Pamela Torres-Rocca</dc:creator>
      <pubDate>Tue, 18 May 2021 17:28:41 +0000</pubDate>
      <link>https://dev.to/pamela454/final-portfolio-project-118f</link>
      <guid>https://dev.to/pamela454/final-portfolio-project-118f</guid>
      <description>&lt;p&gt;For my final project I am creating an application that functions as an electronic medical record. For this project, I thought it was important to have two different users so that the application can be experienced as either a patient or as an administrator.  Patients are able to log in and see their account balance. From there they can make a payment towards their balance. As an administrator, you can add a charge to an account. I used the enum attribute in Ruby on Rails to store the value of either a patient or admin in the database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Account &amp;lt; ApplicationRecord
    enum status: [:patient, :admin] #keep track of user role 
    has_secure_password #already validates presence 
    validates :name, uniqueness: true
    has_many :departments
    has_many :payments 
    accepts_nested_attributes_for :departments, :payments 
    after_initialize :set_defaults

    def set_defaults
        self.balance ||= 0   #if nil, set default 
    end

 #after_initialize do #default value is patient 
   #if self.new_record?
    # self.status ||= :patient 
  # end
 #end

end

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each account can have many payments and many departments associated with it. The departments each carry a charge that totals to the account balance. The payments store the payment information submitted by a patient and update the account balance through a method written on the account model. &lt;br&gt;
     When the patient logs in they can see their account balance and any department charges associated with the account. They can then choose to submit a payment by credit card through the payment form. Submitting a payment through the payment form dispatches an action to add a payment as well as get the current account so that the account data refreshes on the user page. Redux manages the store and displays the new account balance without refreshing the page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    Add Payment Action

&amp;gt;  export const newPayment = (paymentData, history) =&amp;gt; {
&amp;gt;  
&amp;gt;   return (dispatch) =&amp;gt; {
&amp;gt;     const url = `http://localhost:3001/api/v1/accounts/${paymentData.account_id}/payments/new`;
&amp;gt;     
&amp;gt;     return fetch(url, {
&amp;gt;       method: "POST",
&amp;gt;       credentials: "same-origin",
&amp;gt;       headers: {
&amp;gt;         "Content-Type": "application/json",
&amp;gt;       },
&amp;gt;       body: JSON.stringify(paymentData),
&amp;gt;     })
&amp;gt;     
&amp;gt;       .then((res) =&amp;gt; res.json())
&amp;gt;       .then((payment) =&amp;gt; {
&amp;gt;         console.log(payment);
&amp;gt;         if (payment.error) {
&amp;gt;           alert("error");
&amp;gt;         } 
&amp;gt;         else 
&amp;gt;         {
&amp;gt;           dispatch(addPayment(payment.data));
&amp;gt;           console.log(payment.data);
&amp;gt;           //call additional action to update account
&amp;gt;           dispatch(getAccount(payment.data, history));
&amp;gt;           //history.push(`/accounts/${paymentData.account_id}`);
&amp;gt;         }
&amp;gt;       })
&amp;gt;       .catch(console.log);
&amp;gt;   };
&amp;gt; }; 

Account Component Displaying User Data 

&amp;gt; import { connect } from "react-redux";
&amp;gt; import React from "react";
&amp;gt; import Accounts from "./Accounts.js";
&amp;gt; import { withRouter } from "react-router-dom";
&amp;gt; import { Button } from "react-bootstrap";
&amp;gt; import { getDepartments } from ".././actions/currentDepartments.js";
&amp;gt; 
&amp;gt; 
&amp;gt; 
&amp;gt; const Account = (props) =&amp;gt; {
&amp;gt; 
&amp;gt;     const handleClick = (e) =&amp;gt; {
&amp;gt;         e.persist();
&amp;gt;         e.preventDefault();
&amp;gt;         props.getDepartments(props.account.account.id, props.history);
&amp;gt;     };
&amp;gt; 
&amp;gt;     return (
&amp;gt;         &amp;lt;div className="container"&amp;gt;
&amp;gt;             &amp;lt;div className="row align-items-center"&amp;gt;
&amp;gt;                 &amp;lt;div className="col"&amp;gt;
&amp;gt;                     &amp;lt;h2&amp;gt;
&amp;gt;                         {" "}
&amp;gt;                         {/* can assign a key by converting to an integer? item index? */}
&amp;gt;                         &amp;lt;label&amp;gt; Account Name &amp;lt;/label&amp;gt;
&amp;gt;                         {props.account
&amp;gt;                             ? ` - ` + props.account.account.attributes.name
&amp;gt;                             : null}
&amp;gt;                         &amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;
&amp;gt;                         &amp;lt;label&amp;gt; Account Balance &amp;lt;/label&amp;gt;
&amp;gt;                         {props.account.account.attributes.balance != null
&amp;gt;                             ? `  $` + props.account.account.attributes.balance
&amp;gt;                             : null}
&amp;gt;                     &amp;lt;/h2&amp;gt;
&amp;gt;                     {props.account.account.attributes.status === "patient" ? (
&amp;gt;                         &amp;lt;Button onClick={handleClick}&amp;gt;View Charges&amp;lt;/Button&amp;gt;
&amp;gt;                     ) : null}
&amp;gt;                     {localStorage.getItem("status") === "admin" ? (
&amp;gt;                         &amp;lt;Accounts {...props} accounts={props.accounts} /&amp;gt;
&amp;gt;                     ) : null}
&amp;gt;                 &amp;lt;/div&amp;gt;
&amp;gt;             &amp;lt;/div&amp;gt;
&amp;gt;         &amp;lt;/div&amp;gt;
&amp;gt;     );
&amp;gt; };
&amp;gt; export default withRouter(connect(null, { getDepartments })(Account));
&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the backend several methods on the payment model update the user's account balance and the balance of the department. This new data is then displayed on the patient account front end as soon as the url changes to the user's account. &lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
